简体   繁体   English

如何在局域网上部署asp.net c#应用程序?

[英]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. 我有一个asp.net C#项目。 The code works perfectly when I try it on visual studio. 当我在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' " 将其放在"C:\\inetpub\\wwwroot\\Publish" and suddently errors come up. first one says that "unable to load type : 'WebApplication1.Source.WebForm1' " "C:\\inetpub\\wwwroot\\Publish" and suddently errors come up. first one says that "unable to load type : 'WebApplication1.Source.WebForm1' " . "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 以及/OurPage.aspx文件第1行中的信号和错误

"<%@ 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. 所以我用Google搜索了一下,发现可能的解决方案是将上面的代码更改为。

"<%@ 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. 现在看来这个小问题已经解决了,因为我得到了另一个错误,该错误表明文件“ /OurPage.aspx.cs”不存在。 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. 因此,我去检查并有效地从解决方案中的构建源目录中丢失了该文件,因此我将aspx.cs文件粘贴到了该文件中。 Now the error changes again: 现在错误再次更改:

CS0246: Impossibile trovare il tipo o il nome dello spazio dei nomi 'ActivityChecker'; CS0246:不可能进行的活动(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. 因此,我认为这可能是由于我使用deploy函数生成的源目录中甚至缺少活动检查器的事实所致。 but pasting it to the deploy directory doesn't change anything. 但将其粘贴到deploy目录不会更改任何内容。 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) 这是上面的类的代码:(我是asp.net编程的新手,这实际上是我需要提供的全部)

https://github.com/Cicciopalla001/SimplePage/tree/master/WorkingPartCount 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. 因此,基本上,整个代码的目的是从包含大量数据的另一个页面中读取并修剪掉所有无用的页面,仅输出我们需要的2部分,这基本上是零件数和一项工作。 If I build it on visual studio it works perfectly. 如果我在Visual Studio上构建它,则可以完美运行。 I've also set the page to refresh every 15 seconds so that it stays updated without the user doing anything. 我还将页面设置为每15秒刷新一次,以使页面保持更新,而无需用户执行任何操作。 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. 我已经为它安装了iis和asp.net,在win 10上运行(不确定服务器是否是关键),并解决了一些问题,但是对于一个问题,我解决了10个问题,我真的要解决了不知道该怎么尝试了。 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 我也忘记提及我无法直接在IIS上部署,因为我收到一条错误消息:

"Diagnosis: Web Management Service or Remote Agent is not installed or unreachable on the remote computer. “诊断:远程计算机上未安装Web Management Service或远程代理。

Resolution: Verify that Remote Agent Service or Web Management Service are started on the remote computer, depending on which one you are connecting to. 解决方案:验证远程代理服务或Web管理服务已在远程计算机上启动,具体取决于要连接的计算机。 You can do a "net start wmsvc & net start msdepsvc" on the remote computer to ensure these services are started. 您可以在远程计算机上执行“ net start wmsvc&net start msdepsvc”,以确保启动了这些服务。 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. 然后,我尝试强制在IIS上进行明显失败的部署,这是日志。

System. 系统。 AggregateException: One or more errors occurred. AggregateException:发生一个或多个错误。 ---> 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) ThrowIfExceptional(布尔,包括taskcanceledexceptions)

At System. 在系统上。 Threading. 线程。 Tasks. 任务。 Task. 任务。 Wait (Int32 millisecondstimeout, CancellationToken cancellationtoken) 等待(Int32毫秒超时,CancellationToken取消令牌)

At Microsoft. 在微软。 VisualStudio. 视觉工作室。 Web. 网页。 Publish. 发布。 PublishService. PublishService。 Vswebprojectpublish. Vswebprojectpublish。 <> C __ DisplayClass43_0. <> C __ DisplayClass43_0。 B ___ 2 () B ___ 2()

At System. 在系统上。 Threading. 线程。 Tasks. 任务。 Task ' 1. Innerinvoke () 任务'1.内部调用()

At System. 在系统上。 Threading. 线程。 Tasks. 任务。 Task. 任务。 Execute () 执行 ()

---the stack trace end from the previous position where the exception was thrown--- ---堆栈跟踪从引发异常的先前位置结束-

At System. 在系统上。 Runtime. 运行。 CompilerServices. CompilerServices。 Taskawaiter. Taskawaiter。 Throwfornonsuccess (Task Task) Throwfornonsuccess(任务任务)

At System. 在系统上。 Runtime. 运行。 CompilerServices. CompilerServices。 Taskawaiter. Taskawaiter。 Handlenonsuccessanddebuggernotification (Task Task) In Microsoft. Microsoft中的Handlenonsuccessanddebuggernotification(任务任务)。 VisualStudio. 视觉工作室。 applicationcapabilities. applicationcapabilities。 Publish. 发布。 ViewModel. 视图模型。 Profileselectorviewmodel. Profileselectorviewmodel。 d __ 127. MoveNext () d __ 127. MoveNext()

---> (inner exception 0) System. --->(内部例外0)系统。 Exception: Compilation failed. 例外:编译失败。 See the Output window for more information. 有关更多信息,请参见“输出”窗口。 <---> <--->

here is what vs shows me : 这是vs给我看的:

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 严重性代码项目描述文件行状态删除Web部署活动失败(无法连接到远程计算机(“ 192.168.1.128”)。请确保您的计算机已安装Web部署,并且需要该过程(“ Web部署代理服务” )已启动。有关更多信息,请访问: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. 希望最后一次编辑:显然我的部署代理服务无法正常工作,从而阻止了它的正确构建。

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 :/ ) . 基本上,我从Microsoft Web Platform安装程序安装了一些IIS软件包,使用默认设置为文件夹部署创建了一个全新的部署配置文件,并且通过了(仍然无法通过IIS进行部署,因为现在我显然缺少一些权限,甚至管理员用户也是如此): /)。 took the publish directory and put it in C:\\inetpub\\wwwroot as usual. 照常使用发布目录并将其放在C:\\ inetpub \\ wwwroot中。 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. 所不同的是,现在我可以选择说(在IIS管理器左面板的应用程序中打开它),然后突然开始工作。 apparently it wasn't recognized as an application all this time :/ very upset and confused but still it works!!! 显然,这一直没有被认为是应用程序:/非常烦恼和困惑,但仍然有效!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM