如何运行在单MVC3或更新应用程序(How to run MVC3 or newer applica

2019-09-23 06:29发布

默认ASP .NET MVC 3应用程序正在使用微软的Web开发人员2010 Express创建

应用程序发布到文件系统,并复制到单声道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应用单声道或修复这个错误?

Answer 1:

还有更多的dll比那些需要。 你应该右击你的项目,然后选择添加可部署的依赖关系,然后(如果你使用SQL CE或全部3)检查第一个两个箱

看到这个http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

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



Answer 2:

勾选复制本地=真特别是对于mvc.dll <private>true</private>的提示路径下的文件的csproj



文章来源: How to run MVC3 or newer application in Mono