是否可以让 ASP.NET MVC 3 项目在 Mono 2.10 下运行?
Mono 2.10 的发行说明建议支持 ASP.NET MVC 3.0 和 Razor 使用 XSP。
在 MonoDevelop 2.4.2 (Mac OS X) 中打开新创建的 ASP.NET MVC 3.0 默认项目(使用 Visual Studio 2010 创建)时,缺少以下 DLL:
System.Web.Entity
System.Web.Helpers
System.Web.Mvc
System.Web.WebPages
我将所有这些都替换为从 Windows 安装中获取的 DLL。项目已构建,但在尝试调试项目时收到以下错误消息:
Adding applications '/:.'...
Registering application:
Host: any
Port: any
Virtual path: /
Physical path: /.../Mvc3Test/
Handling exception type TargetInvocationException
Message is Exception has been thrown by the target of an invocation.
IsTerminating is set to True
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
在进行这些替换之前,应用程序运行,但明显缺少引用错误。这表明新 DLL 中的某些内容正在搞砸 XSP 服务器。
我做错了什么?我是不是太简单了?我是 Mono 和 MonoDevelop 的新手,但我能够成功创建、构建和调试 MVC我当前安装的 MonoDevelop 的 2.0 项目。
Mono 2.10's release notes suggest support for ASP.NET MVC 3.0 and Razor using XSP.
Upon opening a newly created ASP.NET MVC 3.0 default project (created with Visual Studio 2010) in MonoDevelop 2.4.2 (Mac OS X), the following DLLs are missing:
System.Web.Entity
System.Web.Helpers
System.Web.Mvc
System.Web.WebPages
All of which I replace with DLLs obtained from my Windows installation. The project builds, but I receive the following error message when trying to debug the project:
Adding applications '/:.'...
Registering application:
Host: any
Port: any
Virtual path: /
Physical path: /.../Mvc3Test/
Handling exception type TargetInvocationException
Message is Exception has been thrown by the target of an invocation.
IsTerminating is set to True
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Prior to making these replacements, the application runs but obviously with missing reference errors. Which would suggest that something in the new DLLs is screwing up the XSP server.
What am I doing wrong? Am I being too simplistic? I'm new to Mono and MonoDevelop, but I am successfully able to create, build and debug MVC 2.0 projects with my current installation of MonoDevelop.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我很高兴。 Mono 的新版本 2.10.1 修复了 ASP.NET MVC 3.0 的问题。它运行顺利。
I'm elated. The new version of Mono, 2.10.1, fixed the issues with ASP.NET MVC 3.0. It is running without a hitch.
工作正常,看看 http://erikzaadi.com/2011/03/02/installscripttorunaspdotnetmvc3withrazoronnginxataopensuseserver /
唯一的技巧是复制正确的程序集...
如果您需要解决方案,可以从 http://labs.erikzaadi.com/monoOnSuse/RazorOnMonoSolution.zip
希望这会有所帮助。
[注意] 您不需要 openSuse 来运行该解决方案,只需一个 mono 2.10 环境,在 Mac 上也可以正常工作。
Works fine, have a look at http://erikzaadi.com/2011/03/02/installscripttorunaspdotnetmvc3withrazoronnginxataopensuseserver/
The only trick is copying the correct assemblies...
If you need the solution, it's available at http://labs.erikzaadi.com/monoOnSuse/RazorOnMonoSolution.zip
Hope this helps.
[Note] You don't need openSuse to run the solution, just a mono 2.10 environment, works fine on mac as well.