2

We have multiple .NET applications that used connecting to SQL Server 2016 through the IP address.

Now, we have set up a domain name connected to 2 IP addresses. The initial connection is very slow, anything between 25 and 40 seconds.

Here is the connection string:

Provider=SQLOLEDB;Server=lpc:chiangmaiserver.ch,51231;Database=ContactDatabase;User ID=****;Password=p@****;Connect Timeout=60;

The strange thing is that sometimes, the connection gets fast for a few minutes, then goes back to slow again.

The same domain used in SSMS does not have the issue.

If we revert to IP address the problem disappears.

I tried all the solutions proposed in previous posts, none of them is working.

9
  • 1
    Why are you using oledb ..you should use use sqlconnection class of dotnet..? Commented Jun 21, 2020 at 4:32
  • I tried both, it doesn't make any difference. We use oledb for legacy reasons. Commented Jun 21, 2020 at 6:12
  • 1
    Why are you using lpc (Shared Memory Protocol)? it only works if server is local. Also it's better to use native client Provider=SQLNCLI11.1 than the legacy SQLOLEDB. Commented Jun 21, 2020 at 8:33
  • 1
    I added a named pipe and the problem is gone. Thank you to both of you for your time. Commented Jun 21, 2020 at 10:59
  • 1
    I would recommend using a named pipe instead of lpc, for an explaination of why, see stackoverflow.com/a/175669/13631126 Commented Jun 21, 2020 at 22:45

0

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.