MVC4 500错误角色管理器

时间:2013-08-06 22:30:13

标签: asp.net-mvc-4

我没有在我的网站上启用了rolemanager,并且我在谈论RoleManager时遇到了500错误,这是非常令人困惑的,我在这里花了6个小时试图弄清楚如何解决这个错误。当我登录我的网站时出现此错误,然后在登录时我提交了我编辑的表单并弹出错误。

  • 模块RoleManager
  • 通知AuthenticateRequest
  • Handler ExtensionlessUrlHandler-Integrated-4.0
  • 错误代码0x00000000
  • 请求的网址http://www.mywebsite.com:80/
  • 物理路径E:\ HostingSpaces \ myspace \ website.com \ wwwroot
  • 登录用户匿名**
  • 登录方法匿名**

这就是500错误说的不知何故我认为这可能与web.config rolemanager有关,这是针对地雷的。这是我的web.config任何有一些建议的人请让我知道我的整个网站因此而失败。哦,这个网站在视觉开发方面很有用。

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<configSections>
<section name="resizer" type="ImageResizer.ResizerSection" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="myname" connectionString="mystring" providerName="System.Data.SqlClient" />
</connectionStrings>
 <appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="true" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
 </appSettings>

 <system.web>
<compilation debug="true" targetFramework="4.0" />
 <authentication mode="Forms">
  <forms name=".loog" loginUrl="~/Account/login" timeout="300" protection="All" path="/"   requireSSL="false" slidingExpiration="true" cookieless="UseCookies" />
</authentication>

  <pages>
  <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
   </namespaces>
   </pages>
 <roleManager enabled="false">
  <providers>
    <clear/>
  </providers>
</roleManager>
<sessionState mode="StateServer" cookieless="false" timeout="720" />
<httpModules>
  <remove name="RoleManager" />
  <add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</httpModules>
</system.web>

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
  <add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</modules>
<httpErrors errorMode="Detailed" />
</system.webServer>

 <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="###" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="###" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="###" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
</assemblyBinding>
</runtime> 
 <resizer>
 <plugins>
<add name="MvcRoutingShim" />
</plugins>
</resizer>
</configuration>

1 个答案:

答案 0 :(得分:1)

我能够修复它我不知道这是否是MVC 4问题但是如果你禁用了RoleManager,你必须采取一个额外的步骤并在你的web.config中

   <appSettings>
    <add key="enableSimpleMembership" value="false" />
</appSettings>