Remote connection, C# with SQL Server (2008)

Asked

Viewed 1,103 times

3

I’m a beginner in C#, and I’m trying to remotely connect my C# application to a SQL Server database that is on another PC (the PC is not on the same network, it’s my friend’s), but it’s giving error. Before you speak, I’ve already set up the firewall, I’ve cleared the door.

Connectionstring:

<add name="connectionString" 
providerName="System.Data.SqlClient" 
connectionString="Data Source = xxx.xxx.xx.xx\nomeDoHost\(instacia padrão SQLEXPRESS), (porta padrão 1433);
Network Library = DBMSSOCN; 
Initial Catalog = nome do banco;
User ID = usuario;Password = senha"/>

Just to make sure the ip that goes on xxx.xxx.xx.xx there is what I find here right : http://www.meuip.com.br/

Exception:

inserir a descrição da imagem aqui

  • I’ve tried that too, I’ve tried that TCP/IP setup by SQL Server Configuration Manager also @Cigano Morrison Mendez

  • It can be a lot. His router, for example, if you don’t have a rule for port 1433, it won’t work.

  • It may be that what I am going to say, some disagree and etc... But I have always had problems connecting with Sqlserver passing the IP. I usually pass the full instance name_machine. This way I no longer have connection problems. Well, this is my experience.

  • A tip, it is easier to put the server on a free SQL server than all this complication.

  • Thanks to everyone who tried to help the tips helped me find the problem, vlw, ta running here quiet

Show 1 more comment

1 answer

2


Filipe, the process is very simple, I have this environment here.

What you should do, in your friend’s PC, you have to release the connection port, I recommend using another without being the standard of SQL, use any one, I use the 25266.

Dai on his pc you must open the port in the firewall as image. inserir a descrição da imagem aqui And in sql Configuration manager as image. inserir a descrição da imagem aqui And also release in its SQL instance access to remote connection as per image. inserir a descrição da imagem aqui Done this, in your webconfig, you must inform the IP his along with the door. ex: 189.55.26.85,25266 or use dynamic DNS update services such as no-ip (as I use here) idevweb.no-ip.org,25266.

connectionString="189.55.26.85,25266" or connectionString="idevweb.no-ip.org,25266"

And everything works perfectly.

  • Good guy, I didn’t even think about the DNS I’ll try to do with a DNS in no-ip, but those steps you said there I’ve done only with the Standard Port 1433, SQL, and msm so of exception

  • That’s right, so I recommended using another port, because in the standard port I can not explain the reason, but it seems that there is a lock, or trm that configures the manager Configuration better.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.