2012-10-26 67 views
1

我正在学习本教程:http://robbincremers.me/2012/02/22/using-windows-azure-access-control-service-to-provide -a-single-sign-on-experience-with-popular-identity-providers /#comment-469MVC4 Windows Azure ACS 500内部服务器错误验证表单

使用本指南或其他,当在Web配置中取消注释认证表单以使用下载的自定义html登录表单时从Windows Azure访问控制门户,我得到一个500内部服务器错误。什么可能是错的?

它只是增加验证表单

<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> 
+0

听起来像一个'IIS'问题。 – kush

+0

哪里是你的system.identityModel web.config的参数?此外,你可能想看看(这篇文章)[http://acloudyplace.com/2012/08/creating-a-custom-login-page-for-federated-authentication-with-windows-azure-acs/]其中有一个工作代码示例供下载。您所需要的只是使用您的ACS命名空间来配置ACS中的相关信息。 – astaykov

+0

你应该接受对你有帮助的答案 –

回答

3

这是因为认证要素被定义了两次。 web.config中只能存在一个。第14行你有这样的:

<authentication mode="None" /> 

在线21你有这样的:

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

删除或注释掉这些行来解决该问题之一。

+0

非常感谢!这么多时间工作,我没有停下来看到它! – javimaravillas

+0

我现在就为您的答案投票。抱歉耽搁了! – javimaravillas