locked
Local to remote web server publishing RRS feed

  • Question

  • User1922990443 posted

    Hi All

    I am using VS Express for Web 2012, I created a web site, setup users, membership roles etc, it all works fine locally, but when I upload the entire site to a remote web server, I cannot login (error displayed below) and shown below is the connection string.  Now I thought, that when you upload the site, it takes the local db with it and you should be able to login with the db that gets setup when you create users etc.

    Connection string:

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

    Error from web site:

    Keyword not supported: '(localdb)\v11.0initial catalog'.              Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.            
    Exception Details: System.ArgumentException: Keyword not supported: '(localdb)\v11.0initial catalog'.
    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.                  

    Stack Trace:

    [ArgumentException: Keyword not supported: '(localdb)\v11.0initial catalog'.]
       System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5328764
       System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +95
       System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +59
       System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
       System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +167
       System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +61
       System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +66
       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) +118
       System.Web.Providers.DefaultMembershipProvider.CheckPassword(String userName, String password, Boolean updateLastActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +81
       System.Web.Providers.DefaultMembershipProvider.ValidateUser(String username, String password) +105
       System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +59
       System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +113
       System.Web.UI.WebControls.Login.AttemptLogin() +119
       System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +75
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +114
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +159
       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) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    


     

    Tuesday, June 11, 2013 6:14 AM

Answers

  • User1922990443 posted

    Hi

     

    I thought I had replied to this, maybe not, must be old age kicking in, any ways I sent a nice little email to my ISP, and hey presto it all started working, just gopes to show the pen is mighter than the sword, thx to all who replied.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 20, 2013 5:37 PM

All replies

  • User-1716253493 posted

    try this

    Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet-chester-20130601083200.mdf;Integrated Security=True;User Instance=True



    Tuesday, June 11, 2013 6:26 AM
  • User1922990443 posted

    Changed connection to what you suggested, throws up this error:

     

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)              Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.            
    Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.                  

    Stack Trace:

    [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5296071
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558
       System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5308555
       System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
       System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +920
       System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
       System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +434
       System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +5311099
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +37
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) +558
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) +67
       System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1052
       System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
       System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +167
       System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +143
       System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +83
       System.Data.SqlClient.SqlConnection.Open() +96
       System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +79
       System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +384
       System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +241
       System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +26
    
    [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
       System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +170
       System.Web.Providers.ModelHelper.GetStorageMetadata(String providerName, DbConnection connection, String ssdl) +35
       System.Web.Providers.ModelHelper.CreateMetadataWorkspace(String providerName, DbConnection connection, String csdl, String ssdl, String msl) +154
       System.Web.Providers.ModelHelper.CreateEntityConnection(ConnectionStringSettings setting, String csdl, String ssdl, String msl) +109
       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) +118
       System.Web.Providers.DefaultMembershipProvider.CheckPassword(String userName, String password, Boolean updateLastActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +81
       System.Web.Providers.DefaultMembershipProvider.ValidateUser(String username, String password) +105
       System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +59
       System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +113
       System.Web.UI.WebControls.Login.AttemptLogin() +119
       System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +75
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +114
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +159
       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) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    
    Tuesday, June 11, 2013 7:11 AM
  • User1985864055 posted

    Now I thought, that when you upload the site, it takes the local db with it and you should be able to login with the db that gets setup when you create users etc.

    This is not true except for SQL Server Compact.  You can't do that with LocalDB because it isn't designed to run under IIS.  What is the remote server -- a hosting provider or a server on your company's network.  If it's the former, see this tutorial for information about how to get your membership database deployed:

    http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/introduction

    Tuesday, June 11, 2013 10:11 AM
  • User1922990443 posted

    Hi

    I have to play devils advocat, so when you design a site with asp.net, use the asp configuration, create users, membership roles etc, it creates a db in the appdata folder, I am correct in saying you cannot use that db in a production ebnviroment, if not then why does it create it in the first place, if you can then it's back to my problem above.

     

    I am using a hosting company for the site, in answer to your question.

    Tuesday, June 11, 2013 12:13 PM
  • User-801004448 posted

    Connection string looks incorrect to me.

    There should be keyword and separator to identify sql server in this part (LocalDb)\v11.0Initial Catalog

    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="(LocalDb)\v11.0Initial Catalog=aspnet-chester-20130601083200;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-chester-20130601083200.mdf" />
    Wednesday, June 12, 2013 11:07 PM
  • User-166373564 posted

    Hi,

    Besides what our community members mentioned above, you could get help from your hosting company directly, I think they can give you more precise solution for you,

    At the same time you can also refer our deployment strategies, and learn how to deploy your web project with SQL Server database, you specify SQL Server deployment options on the Package/Publish SQL tab of the project Properties page to deploy a SQL Server database,

    Please check our msdn document below,  perhaps it can give some tips for you,

    #ASP.NET Web Application Project Deployment 

    http://msdn.microsoft.com/en-us/library/dd394698%28v=VS.100%29.aspx

    Regards

    Tuesday, June 18, 2013 3:06 AM
  • User1922990443 posted

    Hi

     

    I thought I had replied to this, maybe not, must be old age kicking in, any ways I sent a nice little email to my ISP, and hey presto it all started working, just gopes to show the pen is mighter than the sword, thx to all who replied.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 20, 2013 5:37 PM