web.config文件角色管理器部分中的配置错误 [英] configuration error in web.config file role manager section

查看:103
本文介绍了web.config文件角色管理器部分中的配置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将asp网站托管到托管公司时,会出现此错误.该网站在本地计算机上本地运行,但在Internet上会出现此错误.

配置错误

Please i get this error when i hosted my asp website to a hosting company.The website runs locally on my local machine but on the internet it brings this error.

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



源错误:



Source Error:

Line 250:    <rolemanager>
Line 251:      <providers>
Line 252:        <add name="AspNetSqlRoleProvider" connectionstringname="LocalSqlServer" applicationname="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 253:        <add name="AspNetWindowsTokenRoleProvider" applicationname="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 254:        <add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionstringname="LocalMySqlServer" applicationname="/" />


这是我的web.config文件


This is my web.config file

<configuration>
    <system.net>
        <mailsettings>
            <smtp>
                <network host="mail.utoomuch.com" port="25" username="lord123" password="bandamos" />
            </smtp>
        </mailsettings>
    </system.net>
    <!--<connectionstrings>
        <add name="LordsBannerMotorsConnectionString1" connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\LordsBannerMotors.mdf;Integrated Security=True;User Instance=True" providername="System.Data.SqlClient" />
    </connectionstrings>-->
    <connectionstrings>
        <add name="LordsBannerMotorsConnectionString1" connectionstring=""Data Source=tcp:s02.winhost.com;Initial Catalog=DB_47628_lordsbanner;User ID=DB_472348_lordsbanner_user;Password=username17;Integrated Security=False;"" />
    </connectionstrings>
    <system.web>
        <trust level="High" />
        <pages>
          
            </assemblies>
        </compilation>
        <authorization>
            <allow users="?" />
        </authorization>
        <authentication mode="Forms">
            <forms loginUrl="~/StaffLogin.aspx">
            </forms>
        </authentication>
        <membership defaultprovider="LordsBannerMotorsSqlMembershipProvider">
         userIsOnlineTimeWindow="15">
            <providers>
                <remove name="AspNetSqlMembershipProvider" />
                <add name="LordsBannerMotorsSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider,                     <br mode=" hold=" />                     System.Web, Version=4.0.0.0, Culture=neutral,                     <br mode=" connectionstringname="LordsBannerMotorsConnectionString1">
                     enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false"
                     applicationName="LordsBannerMotors" requiresUniqueEmail="true"
                     passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
                     minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
                     passwordStrengthRegularExpression="" />
            </add></providers>
        </membership>
        <rolemanager enabled="true" defaultprovider="LordsBannerMotorsSqlRoleProvider">
            <providers>
                <remove name="AspNetSqlMembershipProvider" />
                <add name="LordsBannerMotorsSqlRoleProvider">
                connectionStringName="LordsBannerMotorsConnectionString1"
                     applicationName="LordBannerMotors"
                         type="System.Web.Security.SqlRoleProvider,                       
                     System.Web, Version=4.0.0.0,Culture=neutral, 
                     PublicKeyToken=b03f5f7f11d50a3a" />
            </add></providers>
        </rolemanager>
       

please i will appreciate your help thanks.God bless you as you help me out

推荐答案

您好,
您是在页面中引用任何连接字符串吗?
因为您的配置文件中没有任何连接字符串,并且您的应用程序正尝试使用连接字符串LocalSqlServer(实际上不存在)连接到数据库.因此,您需要将此连接字符串添加到您的web.config文件中.
Hi,
You are referring any connection string in in your pages?
Because there is no any connection string in your configuration file and your application is trying to connect to the databse with the connection string LocalSqlServer (Which is not there actually). So, you need to add this connection string to your web.config file.
<connectionstrings>
    <clear />
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionstring="Data Source=tcp:sql.discountasp.net;Initial Catalog=SQL_numid_account;User ID=SQL_numid_user;Password=pw_here">
    providerName="System.Data.SqlClient" />
</add></connectionstrings> 





--Amit





--Amit


您需要做的就是添加属性< clear>到配置文件提供程序,角色管理器提供程序和成员资格提供程序.这样做会覆盖从计算机的machine.config文件继承的默认属性.

< rolemanager enabled ="true" defaultprovider ="LordsBannerMotorsSqlRoleProvider">
< providers>
< clear>
<删除名称="AspNetSqlMembershipProvider">
< add name ="LordsBannerMotorsSqlRoleProvider">
connectionStringName ="LordsBannerMotorsConnectionString1"
applicationName ="LordBannerMotors"
type ="System.Web.Security.SqlRoleProvider,
System.Web,版本= 4.0.0.0,文化=中性,
PublicKeyToken = b03f5f7f11d50a3a"/>

All you need to do is to add the attribute <clear> to the profile provider ,role manager provider and the membership provider.Doing this overides the default property which inherits from the machine.config file of the machine.

<rolemanager enabled="true" defaultprovider="LordsBannerMotorsSqlRoleProvider">
<providers>
<clear>
<remove name="AspNetSqlMembershipProvider">
<add name="LordsBannerMotorsSqlRoleProvider">
connectionStringName="LordsBannerMotorsConnectionString1"
applicationName="LordBannerMotors"
type="System.Web.Security.SqlRoleProvider,
System.Web, Version=4.0.0.0,Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />


这篇关于web.config文件角色管理器部分中的配置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆