3

I am trying to connect my application with a database on the server for production but it is throwing an error like 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

In the web.config I had the connection string for development that worked perfectly but when I changed it for production, it is not working. Here is what I did:

<connectionStrings>
  <add name="Vulosjet"
       connectionString="Data Source=IP;Initial Catalog=Vulosjet;Integrated Security=false;User ID=********;Password=********" />
  <add name="Vulosjet_app.Properties.Settings.VulosjetConnectionString"
       connectionString="Data Source=IP;Initial Catalog=Vulosjet;Integrated Security=false;User ID=********;Password=********"
       providerName="System.Data.SqlClient" />
</connectionStrings>

Any help please?

6
  • you have put user name and password! Commented Apr 6, 2018 at 7:44
  • but are not real username and password Commented Apr 6, 2018 at 7:47
  • don't use two or more names and i have already answer it see my answer list it would help you Commented Apr 6, 2018 at 7:47
  • What should I change in my connection string in order to work? Commented Apr 6, 2018 at 7:48
  • 1
    please add more tags. this is clearly not a c# issue Commented Apr 6, 2018 at 7:49

2 Answers 2

4

You're missing the providerName in your Vulosjet connection string.

Use only one connection name and you can change the content via your deployment method. Think of it as a variable with different values depending on where it's deployed. Read about "web.config transformations" to see how you achieve that.

Second, make sure that you can access the db server from your production environment.

Sort out these things and you'll be good to go.

Sign up to request clarification or add additional context in comments.

Comments

1

There are many possible reasons:

  • Sql Server instance name is different (not MSSQLSERVER which is the default) - you would need to specify this in the server name e.g. 10.10.42.53/SQLProd or something
  • What protocols are configured for SQL on the Prod server? You may need to enable TCP/IP if you want to connect that way...
  • There is a firewall issue, either software on the SQL server in Prod or somewhere in the network in between the two.
  • There is a basic networking problem - there is no direct route for the PROD web server to talk to the PROD SQL server.

What this isn't (yet) is an authentication issue. it just can't see the server/instance

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.