Last post Oct 06, 2011 04:05 AM by InternetRetailer
Oct 03, 2011 04:49 AM|InternetRetailer|LINK
I have a bit of an odd error occuring when trying to connect to SQL 2008 R2 from a website created using .Net 4.
The error message is:
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.)
And occasionally, the error message is:
System.Data.SqlClient.SqlException (0x80131904): A severe error occurred on the current command. The results, if any, should be discarded.
The really odd thing is, this error only started happening Friday and only when running the project from my development PC; on the live server the website works as designed and is connecting to the same database without a problem.
The error also seems to be intermittent, working on some SQL connects and erroring on others.
Has anyone encountered this problem before? It suggests a database server / network problem?
Oct 03, 2011 05:11 AM|kipo|LINK
Where is that database - on the same machine or on some remote server? If it's remote, have you enabled remote connections?
Oct 03, 2011 05:21 AM|salman behera|LINK
check you datasourse,table name etc...
connectionString="Data Source=(local);Initial Catalog=DatabaseName;User Id=UserName;Password=PassWord;"
Oct 03, 2011 05:23 AM|tarunSaini|LINK
your remote host doesnot connect with your connection string ,please check your connection string setting.
if you give me your connection string then i help you
Oct 03, 2011 05:46 AM|InternetRetailer|LINK
Guys, I appreciate the quick response but please read my post in full.
The website has been working perfectly fine until last Friday when an intemittent connection error started occuring, but only from the development PC; the live website that uses the same underlying database but sits on a web server connects and works fine.
Oct 03, 2011 05:49 AM|salman behera|LINK
so,domain server may slow or your internet connection may slow...
that's why transport type error show...so,contact your domain provider..
Oct 03, 2011 05:52 AM|kipo|LINK
That is the best evidence that the problem is with the connection with the database. You didn't answer if you use 3rd party hosting or your own? If it's 3rd party, than it's possible that your host started to forbid remote connections on Friday...
Oct 03, 2011 06:45 AM|InternetRetailer|LINK
It is internal hosting. Yes, the problem is to do with connecting the the SQL Server.
As the live website is not experiencing any problems and it is using the same connection string to the same database, the issue is why is the website on the development PC encountering intemittent connection failures with the connection being forcably closed
Looking on the SQL logs a process is being killed by SQL each time the error occurs.
Oct 03, 2011 06:50 AM|amitpatel.it|LINK
Is it possible to access server byyour managmenet studio from you web server where you are executing your application ?
Becasse there are might be chanses that database server is not accessible from your web server then not issue with your code but network or widnow problem with sql connection.
Oct 03, 2011 07:03 AM|InternetRetailer|LINK
I can connect to the SQL Server using Enterprise Manager without any problems. The website on the development PC DOES connect to SQL Server sometimes, but then fails on random further connections.
Looking at posts on other forums there seem to be lots of possible causes but the frequently reoccuring ones are:
a) Network issue between the database server and desktop PC causing data packets to be lostb) SQL Server settings; I’ve noticed from the log file on SQL2 that a process is being killed each time the error occursc) Connection pooling; a connection assumed still open by .Net has since been ‘decapitated’ by SQL Server memory paging. This can happen when the server on which SQL runs is reaching the limits of its memory.
Its odd how it is affecting the development environment but not live??
Oct 06, 2011 04:05 AM|InternetRetailer|LINK
Problem solved. Although everything was pointing to the SQL Server killing processes and therefore connections, in this case our switch was throttling bandwidth... removing the throttle (increasing from 10Mbs to 100Mbs) has resolved the problem.