我的新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 ?或者服务器有不同的安装程序?


当前回答

简单的修复。在VS2010中,右键单击你的MVC项目,选择“Add deployyable Dependencies…”,选择你想要的选项,然后单击确定

其他回答

我已经做了“更新-包-重新安装Microsoft.AspNet”。Mvc”来修复它在Visual Studio 2015。

除了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.

我添加了“微软ASP。NET Razor”使用管理NuGet包。

在添加引用时,出于某种原因,我只有System.Web.Helpers 1.0.0和2.0.0…但不是3.0.0。

另一个选择是删除对System.Web.Mvc和System.Web.Http的引用…然后重新将它们添加到csproj文件中的包位置(你可以很容易地用文本编辑器编辑项目):

<Reference Include="System.Web.Http">
  <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>

<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>

还要在web上检查程序集的版本。在你的Views文件夹中,并确保它匹配。我有时会忘记还有第二个网络。在该位置配置。

简单的修复。在VS2010中,右键单击你的MVC项目,选择“Add deployyable Dependencies…”,选择你想要的选项,然后单击确定