0

当准备将我的网站迁移到实时 Godaddy 服务器时,除了尝试登录之外,一切都按计划进行。我收到以下错误。我的问题可能与我的网络配置设置方式有关,但连接字符串可以正常连接到数据库。问题是我的站点仍然依赖于本地服务器而不是远程服务器。

给出的错误:

Exception Details: System.ArgumentException: Invalid value for key 'attachdbfilename'.


Stack Trace: 


[ArgumentException: Invalid value for key 'attachdbfilename'.]
System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean        enforceLocalHost, Boolean fixup) +907262
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +4116
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Web.Providers.ModelHelper.CreateEntityConnection(ConnectionStringSettings setting,      String csdl, String ssdl, String msl) +90
System.Web.Providers.ModelHelper.CreateMembershipEntities(ConnectionStringSettings setting) +28
System.Web.Providers.DefaultMembershipProvider.GetPasswordWithFormat(String userName,  Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& format, String&  salt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean&  isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +123
System.Web.Providers.DefaultMembershipProvider.CheckPassword(String userName, String password, Boolean updateLastActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +96
 System.Web.Providers.DefaultMembershipProvider.ValidateUser(String username, String  password) +105
 System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +129
System.Web.UI.WebControls.Login.AttemptLogin() +127
 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean   includeStagesAfterAsyncPoint) +5563

网络配置:

 <!--Godaddy connection string used for live server-->

<add name="GoDaddy" connectionString=" Server=***; Database=***; User ID=****; Password=***; Trusted_Connection=False" providerName="System.Data.SqlClient" />



<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-Kappa Lambda-20130125180802;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-Kappa Lambda-20130125180802.mdf"
  providerName="System.Data.SqlClient" />

</authentication>

<profile defaultProvider="DefaultProfileProvider">
  <providers>
    <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
  <providers>
    <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
  </providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
  <providers>
    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</roleManager>



<!--
        If you are deploying to a cloud environment that has multiple web server instances,
        you should change session state mode from "InProc" to "Custom". In addition,
        change the connection string named "DefaultConnection" to connect to an instance
        of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
   -->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
  <providers>
    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
  </providers>
</sessionState>

4

1 回答 1

2

您的成员资格、角色和个人资料提供者都设置为使用您的 SQL Express 附加数据库,而不是 GoDaddy 的。改变它,它会工作。

我建议不要重命名您的连接字符串,只需给两个相同的名称,然后注释掉(使用<!-- -->)您不想要的那个,因此您不需要手动更新您的角色/成员资格/配置文件配置。

于 2013-03-19T00:35:33.623 回答