C# database connection delay
I have an app, it's done and working, but the users report a small problem with it, and quite frankly i susspected it could be a problem. As the title says the app is written in c# (.net 3.5) and it's using SQL DB. The "problem" is - when the app is first started, it takes about a half a minute to conenct to database.
Could this be somehow reduced?
Thank you for your time!
EDIT1: the DB is local.. sql 开发者_如何学Goserver and .net framework are installed at the same time as the app
EDIT2: when the app is stared it all works fine, and when users open the winform where some DB work needs to be done, the first time it's started they have to wait about half a minute, after that it works fine..
From questions I asked in comments and their respective answers, the conclusion I offer is this:
It seems to me that the server agent service may be set with a startup mode of Manual
. This means the service will only start as and when required by an application:
Manual starts a service as required or when called from an application (according to definition, but only some of the time in practice, depending on the service)
To mitigate this you could create a custom install action which would, as part of your product installation, set this startup mode to Automatic
- this would cause the service to start when Windows starts.
精彩评论