sql server connection fail after the sql server is restarted
i am doing a unit test against my project. in one case, i have to stop the sql server and verify if my application could handle such exception elegantly.
but i found the after this test case has run, any test case run after it would fail if the test case need to access the database. and the error was 'transportation level error'.
in each test case, i will setup a new sql connection and close it gracefully. i think开发者_如何学运维 the test cases are isolated very well. i do not understand why restarting the sql server would cause such error.
currently, i will have to hit the sql server myself after it is restarted. i think it is really an ugly fix.
This is normal. Restarting the SQL Server means that all connections get killed, including your application's (possibly pooled) connection. I think you just have to handle this error and retry. Which admittedly is a pain.
精彩评论