Cicciopalla010
Cicciopalla010

Reputation: 21

How to deploy an asp.net c# application on LAN?

Ok let me start this saying that this is driving me crazy. I have an asp.net C# project. The code works perfectly when I try it on visual studio. I use the publish option to get something to deploy. Put it in "C:\inetpub\wwwroot\Publish" and suddently errors come up. first one says that "unable to load type : 'WebApplication1.Source.WebForm1' ". (Sorry if it's not totally accurate but my OS isn't in English.

And signals and error in line 1 of /OurPage.aspx file

"<%@ Page Language="C#" AutoEventWireup="true" Inherits="WebApplication1.Source.WebForm1" Codebehind="OurPage.aspx.cs" %>"

So I Googled a bit and found that a possible solution was to change the above code to.

"<%@ Page Language="C#" AutoEventWireup="true" Inherits="WebApplication1.Source.WebForm1" Codefile="OurPage.aspx.cs" %>"

Where codebehind becomes codefile.

Now it seems like this little problem is solved since I get a different error which says that file '/OurPage.aspx.cs' doesn't' exist. So I went to check and effectively the file is missing from the build source directory while is there in the solution so I took the aspx.cs file and pasted it there too. Now the error changes again:

CS0246: Impossibile trovare il tipo o il nome dello spazio dei nomi 'ActivityChecker'; probabilmente manca una direttiva using o un riferimento a un assembly

Which translates in something like:

Unable to find type or namespace "activity checker; probably missing an using or a reference to an assembly

Originated by:

ActivityChecker ac = new ActivityChecker();

So I thought that this might be caused by the fact that even activity checker is missing from the source directory I generated with the deploy function. but pasting it to the deploy directory doesn't change anything. So I'm guessing I have f.ed up something with the deploy to a directory configuration or there is some kind of standard I don't know in coding that makes my files miss something.

Here is the code of the classes above: (I'm new to asp.net programming and this is really all I need to deliver)

https://github.com/Cicciopalla001/SimplePage/tree/master/WorkingPartCount

So basically the purpose of the whole code is to read from another page that contains a lot of data's and trim away all the useless ones just to output the 2 that we need which are a part count and a job basically. If I build it on visual studio it works perfectly. I've also set the page to refresh every 15 seconds so that it stays updated without the user doing anything. Problem is that my working project doesn't even run when I try to deploy it. please someone save my brain from this I really don't know what to do anymore. I've installed iis and asp.net for it, running on win 10(Not server not sure if it's the key) and solved some issues but for one I solve 10 come up and I'm really coming to the point where I don't know what to try anymore. Hope someone can confirm me that's just a stupid problem and give me a solution and thanks to everyone who will read this poem and try to find a solution. Also sorry for my broken English but as an Italian I know it's kind of a meme. Also I forgot to mention I can't deploy on IIS directly since i receive an error saying

"Diagnosis: Web Management Service or Remote Agent is not installed or unreachable on the remote computer.

Resolution: Verify that Remote Agent Service or Web Management Service are started on the remote computer, depending on which one you are connecting to. You can do a "net start wmsvc & net start msdepsvc" on the remote computer to ensure these services are started. Also, ensure that a firewall is not interrupting communications with the destination."

but none of the given solutions seems to work for me.

I then tryed to force a deploy on IIS that obviusly failed and here's the log.

System. AggregateException: One or more errors occurred. ---> System. Exception: The compilation failed. See the Output window for more information.

---End of the inner exception's stack trace---

At System. Threading. Tasks. Task. ThrowIfExceptional (Boolean includetaskcanceledexceptions)

At System. Threading. Tasks. Task. Wait (Int32 millisecondstimeout, CancellationToken cancellationtoken)

At Microsoft. VisualStudio. Web. Publish. PublishService. Vswebprojectpublish. <> C __ DisplayClass43_0. B ___ 2 ()

At System. Threading. Tasks. Task ' 1. Innerinvoke ()

At System. Threading. Tasks. Task. Execute ()

---the stack trace end from the previous position where the exception was thrown---

At System. Runtime. CompilerServices. Taskawaiter. Throwfornonsuccess (Task Task)

At System. Runtime. CompilerServices. Taskawaiter. Handlenonsuccessanddebuggernotification (Task Task) In Microsoft. VisualStudio. applicationcapabilities. Publish. ViewModel. Profileselectorviewmodel. d __ 127. MoveNext ()

---> (inner exception 0) System. Exception: Compilation failed. See the Output window for more information. <--->

here is what vs shows me :

Severity Code Project description File line status deletion Web Deployment activity failed (failed to connect to remote computer ( "192.168.1.128 "). Make sure that your computer has Web deploy installed and that the process that is required ( "Web Deployment Agent service ") has started. More information at: Http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE

Hopefully the last edit : apparently my deployment agent service isn't working and that prevents it from building correctly.

Upvotes: 0

Views: 623

Answers (1)

Cicciopalla010
Cicciopalla010

Reputation: 21

ok found a solution. or at least it works on the whole lan now. basically i installed some IIS packages from Microsoft Web Platform installer, created a whole new deploy profile for folder deploy with default settings and it went through (still can't deploy via IIS since now I have some permissions missing even on the administrator user apparently :/ ) . took the publish directory and put it in C:\inetpub\wwwroot as usual. The difference is that now i had an option saying something like (turn this in an application in the IIS manager left panel) and it suddently started working. apparently it wasn't recognized as an application all this time :/ very upset and confused but still it works!!!

Upvotes: 1

Related Questions