简体   繁体   English

将ASP MVC应用程序部署到IIS7时出现问题

[英]Problem deploying an ASP MVC application to IIS7

I've got an ASP MVC (1.0) application. 我有一个ASP MVC(1.0)应用程序。 It works fine locally via visual studio and on our dev server which runs IIS6. 它可以通过Visual Studio在我们的运行IIS6的开发服务器上在本地正常运行。 But when I try to deploy to the Test server (running IIS7 on Windows Server 2008 R2) I get only : 但是,当我尝试部署到测试服务器(在Windows Server 2008 R2上运行IIS7)时,我只会得到:

"Could not load file or assembly '<ApplicationName>' or one of its dependencies. Access is denied" (where <ApplicationName> is the name of my application).  

This is followed by a "FileLoadException", a "ConfigurationErrorsException" and two "HttpException" (all with the same message as above) 随后是“ FileLoadException”,“ ConfigurationErrorsException”和两个“ HttpException”(均具有与上述相同的消息)

I deployed via publishing to an empty directory, whose contents were then zipped and transferred to the site directory on the test server. 我通过发布部署到一个空目录,然后将其内容压缩并转移到测试服务器上的站点目录。 If I copy the directories contents to my IIS installation it works fine. 如果我将目录内容复制到IIS安装中,则可以正常工作。 I've checked that networkservices has permission to access the site directories and the temporary directories, which were the solutions I found via google, but it hasn't helped. 我已经检查过networkservices有权访问站点目录和临时目录,这是我通过google找到的解决方案,但没有帮助。 I'm completely stumped. 我完全迷住了。 Any ideas? 有任何想法吗?

Adam 亚当

Does your server have System.Web.Mvc.dll installed in the GAC already? 您的服务器是否已经在GAC中安装了System.Web.Mvc.dll?

If not, you'll need to mark your reference to the System.Web.Mvc.dll in your project as "Copy Local = true" before you publish. 如果不是,则在发布之前,您需要在项目中将对System.Web.Mvc.dll的引用标记为“ Copy Local = true”。 Just right click on the reference and you'll see the option. 只需右键单击参考,您将看到该选项。 Otherwise, System.Web.Mvc won't be in your bin directory. 否则,System.Web.Mvc将不在您的bin目录中。

I wrote about this here: http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx 我在这里写过: http : //haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx

Well, it just got weirder when we tried a different version of our app - we went back to the "Cannot read web.config" error that we had also seen earlier and then had disappeared with the version which gave the above error. 好吧,当我们尝试使用其他版本的应用程序时,这变得很奇怪-我们回到了先前也曾看到的“无法读取web.config”错误,然后消失了,出现了上述错误。 After being convinced it must be a permissions issue for a long time we eventually discovered that the web.config (and who knows what else) had been corrupted in some fashion when we zipped the app to transfer it to the server. 在确信很长时间以来,一定是权限问题之后,我们最终发现,当我们压缩应用程序以将其传输到服务器时,web.config(以及谁知道其他什么)已经以某种方式损坏。 A tar then zip and it just worked. 然后用焦油将其压缩,即可使用。 Never had that problem with ZIP before, but I we'll just use a tar.zip going forward 以前从未遇到过ZIP的问题,但我以后只会使用tar.zip

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

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