我的新ASP。NET MVC Web应用程序工作在我的开发工作站,但不运行在我的Web服务器…


“/”应用程序中的服务器错误。


配置错误

描述:在处理服务此请求所需的配置文件期间发生了错误。请检查下面的特定错误详细信息,并适当修改配置文件。

解析器错误信息:无法加载文件或程序集System.Web。Mvc,版本=1.0.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35'或其依赖项之一。系统无法找到指定的文件。

源错误:

Line 44:         <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 45:         <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 46:         <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 47:         <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 48:         <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

来源文件:C:\inetpub\www.example.org\web.config行:46

程序集加载跟踪:以下信息有助于确定程序集的“System.Web. exe”为何为“System.Web. exe”。Mvc,版本=1.0.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35'无法加载。

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

版本信息:Microsoft .NET Framework版本:2.0.50727.3053;ASP。净版:2.0.50727.3053


我是否需要安装aspnetmvcbeta安装程序?服务器上的Msi ?或者服务器有不同的安装程序?


当前回答

我在。net项目中使用Jenkins,在引用MVC 4时遇到了麻烦。

我最终通过使用基于注册表的.Net参考搜索引擎功能解决了我的问题:

“HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft.NETFramework \ v2.0.50727 \ AssemblyFoldersEx”

您可以创建子键或设置默认键为“c:\myreferenceedir”为例。

它为我保存了MVC版本和ASP.net网页。

在“添加引用对话框”中添加引用非常有用

http://dhakshinamoorthy.wordpress.com/2011/12/04/how-to-register-your-net-assembly-in-gac-and-make-it-show-in-add-reference-dialog/

其他回答

正如其他人所提到的,将这些引用添加到可视化工作室,并将Copy Local设置为true。(我还必须添加System.Web.Webpages)

Microsoft.Web.Infrastructure
System.Web.Razor
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
System.Web.Webpages

除了Haack的帖子,Hanselman也有类似的帖子。BIN部署ASP。NET MVC 3与Razor到Windows服务器没有安装MVC

For me, the "Copy Local = true" solution was insufficient because my Website's project references did not include all the dlls that were missing. As Scott mentions in his post, I also needed to get additional dlls from the following folder on my development box: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies. The error message informed me which dll was missing (System.Web.Infrastructure, System.Web.Razor, etc.) I continued to add each missing dll, one by one, until it worked.

在VS2010中,在解决方案资源管理器中右键单击项目并选择“添加可部署依赖项”。然后勾选下面对话框中与MVC相关的复选框。

这将在项目中创建一个'_bin_deployableAssemblies'文件夹,其中包含其他答案中提到的所有.dll文件。我相信在创建部署包时,会将这些文件复制到bin文件夹中。

如果你没有使用主机提供商,你可以访问服务器安装…然后安装MVC 3更新工具,这样做…它将为您在windows 2003服务器/ IIS6机器上节省数小时的问题。,我在本页这里评论了Nuget.Core.dll版本号不匹配

在尝试了所有方法但仍然失败之后,这便是我的解决方法: 我记得我上次在我的Visual studio中更新MVC版本时出错了,所以我从另一个Visual studio(不同的计算机)运行项目,然后上传dll-s,它工作了。 也许它会帮助到某人……