使用 .NET MVC 4 运行 Mono 3.2.0 [英] Running Mono 3.2.0 with .NET MVC 4

查看:28
本文介绍了使用 .NET MVC 4 运行 Mono 3.2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 Mono 3.0 以在 .NET 4 和 .NET 4.5 下运行 MVC4 站点.我一直在解决各种错误,我该怎么做才能让它运行起来?

I am trying to get Mono 3.0 setup to run MVC4 sites under .NET 4 and .NET 4.5. I've been working through various errors, what can I do to get it up and running?

服务器配置

  • CentOS 5
  • Apache 2.2.3
  • 3.2.0 (tarball Sun Jul 28 00:57:40 UTC 2013);ASP.NET 版本:4.0.30319.170202013)
  • 截至本文发布时,来自 git 的最新 XSP

Apache/Mono 配置

MonoServerPath "/usr/local/bin/mod-mono-server4"

/usr/local/bin/mod-mono-server4 内容:

/usr/local/bin/mod-mono-server4 contents:

#!/bin/sh
exec /usr/local/bin/mono $MONO_OPTIONS "/usr/local/lib/mono/4.5/mod-mono-server4.exe" "$@"

更新

问题的症结在于,Mono 没有随站点需要的 MVC4 一起提供.它仍然具有 MVC3 dll,但它具有 Razor 2 dll,但没有 MVC3 想要起诉的 Razor 1 dll.

The crux of the problem is that Mono doesn't ship with MVC4 which the site requires. It still has the MVC3 dlls, yet it has the Razor 2 dlls but not the Razor 1 dlls which MVC3 wants to sue.

推荐答案

成功

如果你想在 Mono 上运行 MVC4,你需要使用一些目前 Mono 没有提供的 Microsoft dll.

If you want to run MVC4 on Mono, you need to use some Microsoft dlls which are not provided by Mono at this time.

注意事项 - 粗略查看 Mono 源代码,MC4 源代码中似乎存在 3.2.0 版本中不存在的方法和类.可能存在损坏的功能.我正在运行的站点完全是一个针对最新 dll 构建的 MVC3 站点.

A word of caution - Taking a cursory look at the Mono source, there appears to be methods and classes in the MC4 source that do not exist in the 3.2.0 build. There may be features that are broken. The site I am running is for all intents and purposes an MVC3 site built against the latest dlls.

要复制的 Microsoft DLL

  • System.Web.Abstractions - 4.0
  • System.Web.Helpers - 2.0
  • System.Web.Mvc - 4.0

复制 dll 后,如果仍有问题,如果上述修复不起作用,则可能需要进行一些侦查工作.如果您收到一条错误消息,指出 Mono 找不到 DLL,通常是以下三个原因之一:

Once you copy over the dlls, if you're still having problems you may have to do some detective work if the above fix doesn't work. If you get an error message saying that Mono can't find the DLL, it's usually one of three reasons:

问题排查

  1. 是否没有 dll - 您可以尝试使用 Microsoft 版本的 DLL

当正确的 DLL 安装在 GAC 或您的项目文件夹中时,它正在寻找旧版本的 DLL - 您项目中的程序集可能在某处引用该版本.您可以使用绑定重定向来强制使用您使用的特定版本

It's looking for an older version of the DLL when the correct one is installed in the GAC or in your project folder - An assembly in your project is likely referencing that version somewhere. You can use a binding re-direct to force the specific version you have be used instead

仍然找不到 dll - 在 web.config 的编译/程序集部分添加程序集

It stil can't find the dll - Add the assembly in the compilation/assemblies section of your web.config

您收到找不到已搜索的视图..."消息 - 如果该特定视图文件夹中的任何视图存在编译错误,您将收到此消息.

You're getting a 'can't find view searched...' message - if any of the views in that particular views folder have compile errors, then you'll receive this message.

这篇关于使用 .NET MVC 4 运行 Mono 3.2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆