简体   繁体   中英

MVC4 Windows Azure ACS 500 Internal Server Error when Authentication Forms

I´m following this tutorial:http://robbincremers.me/2012/02/22/using-windows-azure-access-control-service-to-provide-a-single-sign-on-experience-with-popular-identity-providers/#comment-469

Using this guide or others, when uncomment the authentication forms in the web config for using the custom html login form downloaded from windows azure access control portal, I get an 500 Internal Server Error. What could be wrong?

It is just adding authentication form

<location path="FederationMetadata">
    <system.web>
      <customErrors mode="Off"/>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <system.web>
    <httpRuntime requestValidationMode="2.0"/>
   <!-- <authorization>
      <deny users="?" />
    </authorization>-->
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <!--Commented out by FedUtil-->
    <authentication mode="Forms"><forms loginUrl="~/Federation/Login.html" timeout="2880" /></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.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <httpModules>
      <add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </httpModules>
  </system.web>

That's because the authentication element is defined twice. Only one can exist in the web.config. On line 14 you have this:

<authentication mode="None" />

On line 21 you have this:

<authentication mode="Forms"><forms loginUrl="~/Federation/Login.html" timeout="2880" /></authentication>

Remove or comment out one of these lines to fix the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM