Search code examples
asp.netsql-server-2005connectionmdf

Connection string setting while deployment


I have ASP.NET project and attached mdf database.I want to deploy it to remote server.I have just ftp account.The project works well on my local but ı had problem while deploying.I changed my connection string like. Please help me what is the problem ?

    <add name="libraryConnectionString" 

    connectionString=" Server =.\SQLExpress; 

    AttachDbFilename= myusername@ftp.myserver.com/App_Data/LIBRARY.mdf;

    Integrated Security=SSPI;

    User Instance=True" 

    providerName="System.Data.SqlClient"/>

</connectionStrings>

Solution

  • You have to create a Ms-Sql server database (remote) along with user via control panel or you may ask to your hosting provider to create a database and user. Once database is created then you may execute your script (You may use Visual Studio Database Publishing wizard) and construct a new connection string for your web-app.

    Have a look at MSDN article - Deploying a Database by Using the Database Publishing Wizard

    The Database Publishing Wizard in Visual Studio enables you to deploy a SQL Server database (both schema and data) to a hosting environment. You can run the wizard by right-clicking a database in Server Explorer and then clicking Publish to provider.