Pier Giorgio Misley
Pier Giorgio Misley

Reputation: 5351

Connect to SQL Server database error

I have my own server. This server has an address myserverdns.ddns.net.

I created a C# web service NOT on my server, I'm developing this WS on my personal computer.

I give you all the informations I have:

I tryed on my c# webservice to add server connection

I always got error 26 or error 40

In my webservice I wrote a Db using Entity framework Code First, and I want to push up my code to this

NOTE: My Webservice will be published on the same server of the SQL Database.

How can I connect this db to my WS? I'm stuck here from 3 days..

Thanks all, I tryed to give you all informations, if something more is needed tell me

PS:

Don't link me all the questions where they explain how to set up TCP/IP or where they say to add the rule on firewall.. I've already done it, thanks

Upvotes: 0

Views: 386

Answers (1)

granadaCoder
granadaCoder

Reputation: 27862

You've created a firewall opening based on Port.

You may need to do it "by application".

https://www.mssqltips.com/sqlservertip/1929/configure-windows-firewall-to-work-with-sql-server/

Using firewall with SQL Server on dynamic ports If you have configured SQL Server to listen on dynamic ports, even then you can use the firewall for your SQL Server instance. To do this you include the "sqlservr.exe" program in your firewall exception list. Just go to exceptions tab and click on 'Add Program' button.

PS

Just because you "did it already", there may have been something you missed.

APPEND

So try a cheap trick.....just to isolate machine connectivity vs code-issues.

Go to your "client" machine, Control-Panel/Admin Tools/ DSN(ODBC).

Create a temporary machine DSN to the sql server. (You can delete it later).

This will isolate the issue "from code"........report back the result, the result will give better guidance to up which tree to bark.

APPEND

Go here and get "PortQryUI"

https://www.microsoft.com/en-us/download/details.aspx?id=24009

and get this tool.

This will let you ping the server....and see if you can get to it at that basic level.

THEN

Go here

http://www.connectionstrings.com/sql-server/

Find

"Connect via an IP address"

"Connect via an IP address" is the MOST specific connection string you can define. (Note, if you're not using sql authentication, then you'll need to change UserID and Password for Trusted_Connection credentials)

It has the IP address, the Port, and the Network Library.

If your DSN test doesn't work, and this "very specific" connection string does not work.....then you've got an issue that means going back through the tutorials (that you said not to post) and go through every detail.

If the DSN test doesn't work, your code will never work. Which again, means going back through the detailed servers.

If PortQryUI doesn't work, then you have a more basic connection issue that is outside of sql server.

Upvotes: 1

Related Questions