3

默认 ASP .NET MVC 3 应用程序是使用 Microsoft Web Developer Express 2010 创建的

应用程序发布到文件系统并复制到安装了 mono 2.10.8 、 Apache 和 mod_mono 的 Debian 服务器。

尝试运行应用程序会导致错误:

Server Error in '/mvc3test' Application

--------------------------------------------------------------------------------

Could not load type 'System.Web.WebPages.Razor.RazorBuildProvider' from assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Description: HTTP 500. Error processing request.

Stack Trace: 



System.TypeLoadException: Could not load type 'System.Web.WebPages.Razor.RazorBuildProvider' from assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
  at (wrapper managed-to-native) System.Type:type_is_assignable_from (System.Type,System.Type)
  at System.Type.IsAssignableFrom (System.Type c) [0x00000] in <filename unknown>:0 
  at System.Web.Compilation.BuildProvider.RegisterBuildProvider (System.String extension, System.Type providerType) [0x00000] in <filename unknown>:0 
  at System.Web.WebPages.Razor.PreApplicationStartCode.Start () [0x00000] in <filename unknown>:0 
  at System.Web.Mvc.PreApplicationStartCode.Start () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0  

--------------------------------------------------------------------------------
Version information: Mono Runtime Version: 2.10.8.1 (mono-2-10/70a5c95 Wed Feb 8 18:11:45 CET 2012); ASP.NET Version: 4.0.30319.1

bin 目录包含从 windows 复制的所需 dll:

EntityFramework.dll
mvc3test.dll
System.Web.Entity.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll
mvc3test.pdb
EntityFramework.xml

所以所有必需的dll都存在

如何以单声道运行 mvc3 或 mvc4 应用程序或修复此错误?

4

2 回答 2

3

需要的dll比那些多。您应该右键单击您的项目并选择 Add Deployable Dependencies,然后选中前两个框(如果您使用的是 sql ce,则选中前三个框)

请参阅此http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

哦,2.10.x 分支目前不支持 MVC4。

于 2012-10-01T01:29:43.617 回答
0

检查 copy local = true 特别是对于 <private>true</private>csproj 文件中提示路径下的 mvc.dll

于 2012-09-30T23:33:41.923 回答