2

再会。尝试在 mod_mono 上运行 asp mvc。看起来没问题,但是当我尝试进入登录页面时看到 500 内部错误:

System.TypeLoadException 无法从程序集“System.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”加载类型“System.Web.Security.MembershipPasswordAttribute”。

说明:HTTP 500。处理请求时出错。

详细信息:非网络异常。异常来源(应用程序或对象的名称):System.Web.Mvc。

异常堆栈跟踪:在 System.Web.Mvc.DataAnnotationsModelValidatorProvider..cctor () [0x00000] in :0

使用身份验证模式“表单”。

项目文件:

    Microsoft.Web.Infrastructure.dll
    System.Web.Helpers.dll
    System.Web.Mvc.dll
    System.Web.Razor.dll
    System.Web.WebPages.Deployment.dll
    System.Web.WebPages.dll
    System.Web.WebPages.Razor.dll

存在于 bin 文件夹中

可能有人有这个问题的解决方案?谢谢。

4

1 回答 1

3

这是因为运行时尚未实现 System.Web.Security.MembershipPasswordAttribute(截至 2014 年 5 月 12 日)。您可以在http://www.go-mono.com/status/status.aspx?reference=4.5&profile=4.5&assembly=System.Web查看需要做的事情

你可以实现你自己的。如果您使用的是 Mono 3.4 版本,那么您应该从 3.4 分支获取代码。类库位于 [mono-code-root]/mcs/class/ 下

您将看到 System.Web.Security.MembershipPasswordAttribute 不存在(也可能是 System.ComponentModel.DataAnnotations.UrlAttribute)。您必须创建这些类并确保它们有效。然后制作并安装它。

您可以在这里看到更多信息: http: //www.mono-project.com/Contributing#Contributing_to_the_Class_Libraries 也在这里:http: //blog.neteril.org/blog/2013/08/11/the-very-basic-guide -to-contribute-to-mono-bcl/

在我的 Mac 上尝试使用 Mono 开发 MVC5 项目时,我也遇到了这个问题。我有你可以从这里得到的代码:https://github.com/nonagon-x/mono/tree/mono-3.4.0-mvc5-support如果你使用的是mono 3.4.0

请注意,我添加的代码不适用于生产。我只是让它能够在我的 Mac 上开发 MVC5。那里没有 NUnit 测试。所以不要将它用于生产。

于 2014-05-12T03:30:35.583 回答