Application state (and shared class member) lost in web service

I am working on a web service that acts as a layer between clients (PC and Windows Mobile) and SQL Server 2005. In SQL Server every user that uses a client has separate accounts. When the users start their clients they are prompted with username and password and a call to the web service is made.

The web service then retrieves database server and instance from its web.config and the username and password from the client call and creates a connection string. The next thing that happens is that the web service tries to make a connection to the database server and if it succeeds the connection string is stored in the application state object with a unique key for the current client (Application.Add(key, connStr)). The key is then returned to the client.

Every time the client calls a web method from now on this key is supplied. When the web service has to communicate with the database server the connection string to use is retrieved from the application state object (Application.Get(key)). After a connection is opened and data is retrieved, updated or deleted, the connections gets closed.

The problem is some sort of time out which seems to occur within about 2 minutes of "idling". This doesn't occur in the development web server in Visual Studio though. I have tried to raise the "ASP script time out" (of the Web Service), "Request execution time out" (of the Web Service) and the "Connection time out" (of the Web Server) without solving the problem.

I have even tried to create a shared class member to store the connection strings in but the same thing happens there. (Private Shared m_ConnectionStrings As New Dictionary(Of String, String))

Does anyone know the solution to my problem?

The clients and the web service are written i .NET.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!