Remote Connection, C # with SQL Server (2008)

3

I'm new to C #, and I'm trying to connect my C # application remotely with a SQL Server database that is on another PC (the PC is not on the same network, it's my friend's), but it is giving error. A before they say that I have already set up the firewall , I have already released the port.

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 be sure the ip that goes on xxx.xxx.xx.xx there is what I find here né: link

Exception:

    
asked by anonymous 07.07.2015 / 01:07

1 answer

2

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

What you should do, on your friend's PC, you have to unlock the connection port, I recommend using another one without being the default SQL, use any one, I use 25266.

Dai on his pc you should open the port on the firewall as picture. Andinsqlconfigurationmanageraccordingtoimage. And also release in the SQL instance of it access to the remote connection according to image. Onceyouhavedonethis,inyourwebconfig,youmustentertheIPofitalongwiththeport.eg:189.55.26.85.25266orusedynamicDNSupdateservicessuchasno-ip(asIusehere)idevweb.no-ip.org,25266.

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

And everything works perfectly.

    
07.07.2015 / 19:46