respina
respina

Reputation: 11

A network-related or instance-specific error occurred while establishing a connection to SQL Server

I have uploaded my website to my webhost and it works great except the form authorization. When I try to login I get 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)

When I deploy the website I publish it from Visual Studio to a local folder and then upload it to the webhost via a FTP client program. The problem here is that the App_Data folder is empty when I publish the website to my local folder. Could this be the problem?

Upvotes: 1

Views: 205

Answers (3)

this. __curious_geek
this. __curious_geek

Reputation: 43207

First, lets check what is the problem ?

Your app is trying to access your Membership database. your web.config carries the same connectionString as what you use on your local machine. your local connStr will definately not work on the production server, hence the error. So you must also deploy your database on the production server and update the connectionString in your web.config to point it to the database on the server-side.

How can I solve this error?

please check if you have db in App_Data folder, if you have the db there then pleade also deploy the same on server. you will not need to change anything in web.config in this case but the your production sql server must allow user-instances, which I think mostly this will not be allowed. you can check this with your server admin. In case if user-instances are not allowed, ask the admin to give you db on server and provide access credentials to the db. This will include db-server pointer, db name, username and pwd. while publishing your app, update the connection string in yuor web.config to point to this new db. you will also need to deploy the db as an additional effort. for this, you can use Database publishing wizard.

Upvotes: 2

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

It seems that there's no SQL Server running on the remote host or at least not accepting connections.

Upvotes: 0

spinon
spinon

Reputation: 10847

Yeah either your database is not there or your connectionstring info is dev machine specific and not working on your host. But either way it is pretty obvious that your app can not talk to your db or find it for that matter.

Upvotes: 0

Related Questions