AD / ASP.NET / MVC:web.config中的配置错误

时间:2015-04-20 16:04:55

标签: asp.net-mvc active-directory

我正在使用vs2013做一个asp.net MVC应用程序。我需要通过活动目录进行ldap身份验证。

我能够显示一个表单,但在提交时,我总是得到配置错误:

Server Error in '/' Application.

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

    Parser Error Message: An operations error occurred.

    Source Error: 

    Line 33:         <add name="ADMembershipProvider"
    Line 34:             connectionStringName="ADConnectionString"
    Line 35:             type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Line 36:             attributeMapUsername="sAMAccountName"
    Line 37:               />

以下是我对web.config的说法:

<connectionStrings>
  <add name="ADConnectionString" connectionString="LDAP://server:389/DC=us" />
</connectionStrings>
  <system.web>
    <authentication mode="Forms">
      <forms name=".ADAuthCookie" loginUrl="~/Account/Login" timeout="45" slidingExpiration="false" protection="All" />
    </authentication>
    <membership defaultProvider="ADMembershipProvider">
      <providers>
        <clear />
        <add name="ADMembershipProvider"
            connectionStringName="ADConnectionString"
            type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            attributeMapUsername="sAMAccountName"
              />
      </providers>
    </membership>        
  </system.web>

谷歌搜索了一下但无法找到适合我的解决方案。

谢谢!

0 个答案:

没有答案