How to check if SQL Server is running via asp.net
Problem: When my provider shuts down the SQL Server IIS receives a few
error messages and then switches the site to 'SERVICE UNAVAILABLE'.
Before IIS kills itself it is friendly enough to send me an error
message.
****ERROR MESSAGE 1******
System.Data.SqlClient.SqlException: An error has occurred while
establishing a connection to the server. When connecting to SQL Server
2005, this failure may be caused by the fact that under the default
settings SQL Server does not allow remote connections.
This error message happens when the server is offline and my ASP.NET 2
code tries to open a connection
.....
myConnection.Open()
.....
The last error message I receive is
*****ERROR MESSAGE 2*****
System.InvalidOperationException: Timeout expired. The timeout period
elapsed prior to obtaining a connection from the pool. This may have
occurred because all pooled connections were in use and max pool size
was reached
I am not sure if the ERROR MESSAGE 2 really is about the connection
pool, since the sql server is already down. But this might trigger IIS
to set my service unavailable.
What can I do in my asp.net code to detectd if a SQL server is online?
.
Relevant Pages
- Re: asp.net sql trusted connections between machines
... > connect to a remote SQL Server instance w/ Read-Write permissions. ... > connection string in the web.config. ... > Windows Authentication setting for access via IIS doesn't seem pass the ... is this impersonation behavior with IIS and Windows Authentication ... (microsoft.public.dotnet.framework.aspnet) - Re: Classic ASP connectionstring to SQL Server 2005
... So this connection string is in the VB6 dll? ... What is the error message? ... Provider cannot be found. ... can you ping the sql server? ... (microsoft.public.inetserver.asp.db) - Getting an error while testing my first WCF service
... Pro SP2) under IIS, I am using wsHttpBinding. ... "The underlying connection was closed: ... According to the stack dump the InnerException has this error message: ... (microsoft.public.dotnet.framework.webservices) - Re: Problem upgrading Microsoft Office Accounting Professional from 2008 to 2009 using SQL Express 2
... I tried adding the TCP but then I get a error message "Microsoft Office Accounting cannot open the company because of a connection error." ... I assume that's why trying to force a TCP connection doesn't work. ... Rick Byham, SQL Server Books Online ... Since the problem appears to involve some sort of interaction between Microsoft Office Accounting Professionaland SQL Express 2008 hopefully someone in this forum will understand the error message I'm receiving and can suggest some possible solutions for me to try. ... (microsoft.public.sqlserver.connect) - Re: Cannot connect to database
... when you use iis, its uses the aspnet account which is local and is probably not set up to access your sqlserver. ... I open Visual Web Developer 2008 express on desktop and Select File>open Website, and browse to a folder on DevBox. ... An error has occurred while establishing a connection to the server. ... When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. ... (microsoft.public.dotnet.framework.aspnet) |
|