timeout expired failed to start instance

I have a C# windows app created with vs2005 on windows xp pro with sql 2005 server express installed ( it uses a database )

I create a deployment project then install the app on the machine

Every so often - quite rarely but enough to worry about - usually just after a restart - when I start the application I get a timeout expired - something about failing to connect to an instance - I am assuming it is because the database engine has to start up and then it has to creat an instance and all this just exceeds so time limit - I tried putting "Connection Timeout=300" in the connection string in the app.config file - it did change the sqlcmd.connection.connectiontimeout to 300 but it did not get rid of this intermitant problem - Could there be another timeout limit for starting an instance - Error always seems to happen if the database engine is not already running - but does not happen always.

Any Ideas

thanks

-Barb



Answer this question

timeout expired failed to start instance

  • tirengarfio

    Just make sure you have some way to capture both the error message and the call stack, as both may be needed to isolate where the error is coming from.

    Thanks,
    Sarah



  • Deraldo

    I have been trying all many times to get it to happen again - now that I want it to happen, it won't - go figure

    anyway I will keep trying and get back to you when and if it does happen again


  • osman ayhan

    What is the exact error message and call stack that you get at the time of the failure It would help if you were logging this somewhere so you will have it available the next time the error occurs. Since you said that increasing the connection timeout doesn't seem to help, I'm wondering if you are experiencing a different kind of timeout. The specific error information may help us to figure out what's wrong.

    Thanks,
    Sarah



  • Andre_SA

     

    I have the timeout  set for 300   -   I assume that is 5 minutes  -  The exception, when it happens, does not take anywhere near 5 minutes to happen  -  so I don't think any further increase will help.

    This is a windows application that I plan to develop and distribute to users to be run on a PC, so I do not think SQL Server 2005 is an option. I have the deployment prerequistes to include sql 2005 server express.

     

     


  • Peter D.252325

    Barb,

    I have run into similar issues. In my opinion (and this is just my opinion), you probably don't want to go to production with SQLExpress. There is no end to such problems. Now an app that is already running on SQL Express under IIS probably won't have a lot of issues. The good news is that migrating SQL Express to SQL Server is not that difficult. (just search my blog for it). Tools such as DataDude or the red-gate bundle make this migration and maintainance very easy. I also want to add that, once you do get a web app running on SQL Express, then it tends to continue running smoothly. So I am guessing that this problem has something to do with connecting under the user instance, and that part of the operation taking longer than expected. I can't be 100% sure though, but it is a fairly good assumption IMO.

    And if were already not planning to deploy to production with SQL Express, and this problem is a development environment issue only; - SQL Server non-express didn't seem to have any such problems. (I'm speaking just out of personal experience).

    I am sorry I cannot offer a true solution, because I feel this is a product limitation that I can't do much about. The longer timeout and other such solutions may be a cheesy workaround, but IMO a better solution is to simply stick with SQL Server non-express, unless you are severely limited by budget.

    Sahil Malik
    http://blah.winsmarts.com



  • Ilker at Gordion

    I would expect in certain situations (like a fresh computer reboot) that it may take the SQL Server Express instance longer to start up. This can happen because certain dependant features of the operating system (like networking for example) may not be ready yet and so SQL Express is blocking behind the OS waiting for these dependant features to crank up.

    So you need to increase the timeout even more to insure you handle this situation if you are using SQL Server Express and instantiating the instance on the fly. With a normal SQL Server instance the service is automatically started up much earlier during reboot so the chances are it will be ready when you try to use it.



  • http200

    The default Connection Timeout is actually 15 seconds, which is plenty long in most circumstances, but maybe not long enough if that has to include starting up an instance. It still seems like that should be long enough in most cases though.

    I guess we'll just have to wait until you get more error information so we can really be sure of what's happening. Your logging code should provide the information we need. Even with the exact error we may not know exactly what is causing the problem, but it will be a good start so we don't assume we're dealing with one thing when it's really something else.

    Thanks,
    Sarah



  • BI Joe

    I have this in my code:

    try

    {

    conn.Open();

    }

    catch (Exception ex)

    {

    MessageBox.Show("Error Opening Database - Please Restart Application");

    Logger.Log("***Exception Type: " + ex.GetType().ToString());

    Logger.Log("Message : " + ex.Message);

    Logger.Log("Source : " + ex.Source);

    Logger.Log("StackTrace : " + ex.StackTrace);

    this.Close();

    return;

    }

    But I am still waiting - The strange thing is, when I did not have the connection timeout set to 300 ( I assume it was 30 ) the exception was happening quite fequently after a reboot - Once I changed it to 300, it did not happen on my machine. I then asked a friend to install it on their machine and they reported back that they got a timeout expired error - but the program was fine on subsequent starts.

    I could not get it to happen ever again on my machine, even with taking out the setting of the connection timeout. I could not even get it to happen by setting the timeout to 1. The problem has not appeared since but I will let you know if it does.


  • timeout expired failed to start instance