简体   繁体   中英

Configuration Error When Logging-in into admin area

After Configuring my asp.net connectionString in web config file my website run but when i tried to Login into my admin area I get an error message

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: The connection name 'MyconnectionStringName' was not found in the applications configuration or the connection string is empty.

Source Error:

<providers>
Line 16:        <remove name="AspNetSqlMembershipProvider"/>
Line 17:        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="MyConnectionStringName" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
Line 18:      </providers>
Line 19:    </membership>

but it worked perfectly on Local Server.

My web.config file

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>

    <connectionStrings>
  <add name="AsconConnectionString" connectionString="LoginDetails"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
 <system.web>
<customErrors mode="Off"/>
   <membership>
     <providers>
       <remove name="AspNetSqlMembershipProvider"/>
       <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ConnectionDetails" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
     </providers>
   </membership>
        <roleManager enabled="true" />
  <authentication mode="Forms" />
  <compilation debug="false" targetFramework="4.0"/>
    </system.web>
</configuration>

I had same issue. It will work on local but to run on server you need to update schema version to your db. you will not use aspnetdb.mdf directly

you can find script for that and update with your DB. hope this can solve your issue

download this script from this link https://drive.google.com/file/d/0B2D0SiDP8hTFN2tDX04zYVp6OXc/edit?usp=sharing

now you need to add this to your config file

<system.web>
<!-- membership provider -->
<roleManager enabled="true">
  <providers>
    <clear/>
    <add name="AspNetSqlRoleProvider"
        connectionStringName="myportalconstr"
        applicationName="/"
        type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  </providers>
</roleManager>
<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider"
        connectionStringName="myportalconstr"
        applicationName="/"
    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0,           Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </providers>
</membership>

 <trust level="Full" /> 
  <customErrors mode="Off" defaultRedirect="home"/>
  <anonymousIdentification enabled="true"/>

  <profile enabled="true">
  <providers>
    <clear/>
    <add applicationName="/myportal"  connectionStringName="myportalconstr"     name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider"/>
  </providers>

</profile>
</system.web>

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