Setting up connectionstring for host

110 Views Asked by At

Bear with me as I do it first time. I made simple web application that I'm trying migrate to online site. After migrating i got error: [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server.

Is I tried to figure it out i have only localDB connection string. Do i need to make another one and how i can do it?

This is what I got in webconig.

<connectionStrings>
<add name="KlientEntities" connectionString="metadata=res://*/Models.Klient.csdl|res://*/Models.Klient.ssdl|res://*/Models.Klient.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDb)\MSSQLLocalDB;initial catalog=Test;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

This is what I got from hosting:

Classic ASP (ADO Library)   Provider=SQLOLEDB;Data source=mssql4.webio.pl,2401;Initial catalog=databaseName;User ID=Username;Password=password;

ASP.NET (ADO.NET Library)   Server=mssql4.webio.pl,2401;Database=databaseName;Uid=Username;Password=password;
1

There are 1 best solutions below

6
On

You’ll need to update the (deployed) connection string to match the one for your database.

So that is this part:

provider=System.Data.SqlClient;provider connection string="data source=(LocalDb)\MSSQLLocalDB;initial catalog=Test;

This currently references the LocalDb