I have added a database file (.mdf
) to my application using Visual Studio built-in functionality. Database is in the App_Data
folder. It is running fine. But when I publish it and upload it to server it gives 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)
I visited similar situation but confused. I don't know which version and edition of SQL Server is running at server. I upload project using Filezilla. My connection string is as follows in my web.config
:
<add name="ConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient"/>
Please describe process step by step is possible.
Thanks in advance.