Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

General network error: My code or our server?

Status
Not open for further replies.

seefresh

Technical User
Oct 14, 2005
5
US
Hello everyone, this post will be a bit lengthy, so please bear with me. I've been programming asp.net for abou 2 years. I'm not a master by any means, and I do things like I learn from books. Here is my standard way of connection to my mssql database (which is on the same server as my site, so I just use "localhost")

Dim objConnection As New SqlConnection(Application("dbstring"))
Dim strSQL As String = "SELECT * FROM myTable WHERE this='that'"
Dim objCommand As New SqlCommand(strSQL, objConnection)
Dim objDataReader As SqlDataReader

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

Do While objDataReader.Read() = True
'Do what I need to do with the data
Loop

objDataReader.Close()
objConnection.Close()

objConnection.Dispose()
Here's my issue. Our website gets this error 2-4 and as many as 6 or 7 times a day:

General network error. Check your network documentation.
Line ###: objConnection.Open()

I use the method I wrote above for getting data on almost every page in the site. Its a HUGE site, but I've made sure that I close all my connections. This is my global connection string:

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("dbstring") = "Server= Timeout=300;Connection Reset=False;Pooling=False;Max Pool Size=75000;"
End Sub

Here's my web.config file:
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
...

This server has only one website running on it, its a dedicated server. Is there something in my code causing this error to happen so much? We have to restart the sql server everytime this error happens for it to go away. Its very disruptive to the website.
 
It's not the code for connecting to the database that is the problem (as you've said it does work). So, this narrows it down to two potential issues that I can think of:

1) Connections aren't being closed properly (check sp_who in your database).
2) An issue with the network traffic

The error you've provided isn't very specific so I'd guess it's more likely to be #2 but you might want to add some error handling to the above procedure and see if there is any more detailed explantion in the error (i.e. the InnerException).


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
How do you check sp_who in your database? Sorry if that's a stupid question, I'm a coder NOT a server guy... getting real confused on this error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top