Locally I connect to Northwind.mdf but when I upload application to remote server then I get following 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)
These are few options I tried:
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Northwind.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
The above one work locally.
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\ASP\TestSite\App_Data\Northwind.mdf; Integrated Security=True;Connect Timeout=30;User Instance=True;Trusted_Connection=Yes"/>
</connectionStrings>
On server is installed SQL Server 2005
Thanks,
Ilija
Follow these steps:
1: Attach your Northwind.mdf to your Sql Server 2005 on your server using the Sql server Management studio.
2: Modify the connectionstring in your web.config so that it points to the db on your server.
How to detach / attach db.