c# - Mod_Mono + ASP MVC 5 Framework 4.5 - System.Web.Security.MembershipPasswordAttribute 错误

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

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

System.TypeLoadException Could not load type 'System.Web.Security.MembershipPasswordAttribute' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): System.Web.Mvc.

Exception stack trace: at 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文件夹中

有人可以解决这个问题吗? 谢谢。

最佳答案

这是因为运行时尚未实现 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 测试。因此,请勿将其用于生产。

关于c# - Mod_Mono + ASP MVC 5 Framework 4.5 - System.Web.Security.MembershipPasswordAttribute 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23391448/

相关文章:

c# - 应用外观模式的最佳实践

asp.net - 如何将自定义文件扩展名映射到单声道?

asp.net - Mono 中对 ASP.Net 的支持是否已停止?

asp.net-mvc - ASP.NET MVC 4 中的用户控件等效项

c# - 自动映射器投影到更大的对象

javascript - 在 getJSON 中编写 ajax 调用的失败案例

asp.net - Mono vhost配置错误:地址已在使用中

c# - Exchange EWS 获取 BCC 收件人

c# - 如何使用 C# 创建与 UWP 应用程序和 Azure DB 的基本连接

c# - 将货币导出到 Excel 会导致空格字符