在Web配置文件中配置我的ASP.NET ConnectionString之后,我的网站运行运行,但是当我尝试登录到管理区域时,我会收到一个错误消息
配置错误
描述:处理此请求所需的配置文件期间发生了错误。请查看下面的特定错误详细信息,并适当修改您的配置文件。
解析器错误消息:在应用程序配置或连接字符串为空的连接名称'myConneCtionsTringName'。
源错误:
<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>
,但它在本地服务器上完美工作。
我的web.config文件
<?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>
我也有同样的问题。它将在本地使用,但要在服务器上运行,您需要将模式版本更新为数据库。您不会直接使用aspnetdb.mdf
您可以找到该脚本并使用DB进行更新。希望这可以解决您的问题
从此链接下载此脚本https://drive.google.com/file/d/0b2d0sidp8htfn2tdx04zyvp6oxc/edit?usp = sharing
现在您需要将其添加到您的配置文件
<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>