views:

886

answers:

4

I have a web application which is currently running on Windows XP operating system with SQL Server 2005 database and IIS 6.0.

Now, we are trying to upgrade it to IIS 7.0 on Windows Server 2008 and SQL server 2008 database.

When I run the application then it is throwing "A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)" randomly at different database calls.

I have verified using *"sp_who"* that only one connection which I am using is opened.

Can anyone tell me, what could be the cause of this issue?

A: 

Often, it's the database being offline/closed or the SQL Instance being restarted/offline

gbn
+2  A: 

Maybe the database is set to auto-close? This used to be the default for databases created on the older MSDE/Express edition.

ALTER DATABASE YourDatabaseName SET AUTO_CLOSE OFF;

More:

The SQL Server 2005 Express Edition Overview states:

Features like Auto-Close and the ability to copy databases as files are enabled by default in SQL Server Express ...

I can't remember which service pack changed the default, but the New Database UI in the SP3 version of Management Studio Express defaults the Auto Close setting to false.

devstuff
MSDE, yes. Which Express edition was this ever the default in?
John Saunders
Edit: Added more info.
devstuff
A: 

This is an error that occurrs when connecting to database due to a lower layer network-related error that you cannot handle from Sql Server.

It would be great that the API used to conenct handled this error but AFAIK it is not. The only way to solve this is to retry connecting to the database when this error occurrs.

You should try to reconnect at least a couple of times more to get sure that the error is not persistent and if it is the case then throw the exception. My experience tells me that trying to reconnect, the 99.9% of times you will succed.

despart
+1  A: 

This blog post by Michael Aspengren explains the error message "A transport-level error has occurred when sending the request to the server."

Manga Lee

related questions