Connect to SQL Server on remote server

Asked

Viewed 1,002 times

4

I need to connect to an SQL Server service on a remote server via Sqlconnection, C#. Initially, it was not possible to find the server, but I solved this by modifying the hosts file of system32, enabling exception in the server firewall and enabling SQL Server Browser. However, now he gives me an exception saying "The waiting time limit has been reached" when trying to open connection to the bank. What should I do?

Here is an example of the Connection string I’m using: "Data Source=xxx.xxx.xxx.xxx/MSSQLSERVER, 1433;Database=meuBanco;User Id=sa;Password = ************;"

  • 1

    On my web. Conf I use so: <add name="cepConnectionString" connectionString="Password=senha;Persist Security Info=True;Connect Timeout=450;User ID=usuario;Initial Catalog=banco;Data Source=servidor" providerName="System.Data.SqlClient" />. A question you enabled your bank to client?

  • You say enable remote connection on SQL server?

  • This in the database installed on the server.

  • Yes, I enabled in SQL Server, puis exception in firewall and enabled sql server browser. But it was giving that exceeded the time limit

  • 1

    You gave IIS permission to access the bank?

  • What do you mean? I’m wanting to access SQL from a Windows Forms application, IIS interferes?

  • No, I thought it was Web. Guy is hard to know what it can be. Have you entered the mangament studio to know if it’s happening? Have you tried using my Connectionstring I posted?

  • Then, by management studio I opened the server properties and enabled remote connection. In SQL Server Configuration manager I enabled sql server browser and configured TCP/IP. When I put mine

  • Something’s missing. But you’re on the right track.

  • Any more ideas than I can try?

  • You have enabled the services?

  • Yes. SQL Server, Sql Server Browsere Network Browsers are all enabled

  • You can access the bank using the Management Studio (SSMS)?

Show 8 more comments

1 answer

1

One thing that happens on some servers I’ve already touched is that you don’t need to specify the instance in case of remote connection.

Just try using:

Data Source=xxx.xxx.xxx.xxx,1433;Database=meuBanco;User Id=sa;Password=************;

Browser other questions tagged

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