Database Connection Issue

WE have a website that is having issues connecting to a database on our server.  Some days it works and some days users are not able to connect ( Timeout error ).

Connection String:
"User Id=<id>;Password=<password> Catalog=<catalog>;Server=<servername>; Connection Timeout=120;"

Open in new window

If I change server = "localhost" then I am able to connect to the server, but after a few days someone will complain they timeout again.  In order to get the website to work, i have to keep changing the connection string ( server = servername or server = localhost ) when someone timesouts.

We haven't figured out what the problem is, so I came here looking for suggestions.  My IT Director doesn't think it has anything to do with DNS.

A few comments:
- Website: ASP.NET 2008, Visual Basic
- Only around 5 employees access the website
- The problem usually is reported around the same time of day, but that could be that is the only time they use the program
- We have multiple websites/applications accessing the same server with no problems
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

To help here is difficult but I also think this has nothing to do with DNS.

But if you have many applications and just one of them has this problem then you have to investigate IIS settings. (I suppose you are using IIS.) Do all these applications use one App pool? Does App Pool recycling help instead of conn str update?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Double check the handling in the application that experiences issues. To make sure the conect ions are not left hanging.

Another option is to look at connection pooling.

You are not providing information .........on which
Radhakrishnan RSenior Technical LeadCommented:

Which operation system the website running under?. When the issue occurs, what's the resource usage on the server? I.e - Is the memory or CPU jumping to higher?

If the CPU spikes out, and you have the web.config file, then check this line <httpRuntime maxRequestLength="4096" />. Do you have this line? if not, ignore. But monitor the CPU/Memory usage at the time of issue.
Mike LazarusAct! Evangelist - CRM ConsultantCommented:
If localhost times out, it definitely not DNS.
Have you looked for anything in the IIS Logs and windows EventViewer Logs around the time it happens?

You might try adding a Connect Timeout in the web.config
<add key="DBConnection" value="server=LocalHost;uid=sa;pwd=;database=DataBaseName;Connect Timeout=200; pooling='true'; Max Pool Size=200"/>

If always at the same time, you might think about what else happens ... I recall one site where the cleaner unplugged a network router to use the vacuum cleaner. Took a while before I cottoned on :-(
mmsiAuthor Commented:
I'm going to have someone look into IIS to see if that is the problem.  When the web app was first created I didn't have these issues but I think around the time we moved everything to a new server is when people started getting timeouts.

I'm closing this question for further investigation.  Thank you for the replies.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.