【问题标题】:Mod_Mono + ASP MVC 5 Framework 4.5 - System.Web.Security.MembershipPasswordAttribute ErrorMod_Mono + ASP MVC 5 Framework 4.5 - System.Web.Security.MembershipPasswordAttribute 错误
【发布时间】:2014-05-12 11:30:35
【问题描述】:

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

System.TypeLoadException 无法加载类型 来自程序集的“System.Web.Security.MembershipPasswordAttribute” 'System.Web,版本=4.0.0.0,文化=中性, PublicKeyToken=b03f5f7f11d50a3a'。

描述:HTTP 500.Error processing request.

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

异常堆栈跟踪:在 System.Web.Mvc.DataAnnotationsModelValidatorProvider..cctor () [0x00000] 在 :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 文件夹中

可能有人解决了这个问题? 谢谢。

【问题讨论】:

    标签: c# asp.net-mvc mod-mono system.web


    【解决方案1】:

    这是因为运行时尚未实现 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 如果你使用的是单声道 3.4.0

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

    【讨论】:

      猜你喜欢
      • 2016-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-07
      • 1970-01-01
      • 2012-02-16
      • 1970-01-01
      相关资源
      最近更新 更多