Join 150,413 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 973 people online right now. Registration is fast and FREE... Join Now!
I have a .NET application installed on a specific server calling a web service on another server. The connection has no problem to call the web service BUT when simulating alote of users using my system (1 users per 5 seconds for about 7 minutes) i get this error on the server having the web service since 1 user using the system will make 1 web service call:
The underlying connection was closed: An unexpected error occurred on a receive.
Is this because the server has an overload? i am losing the connection for some reason, is there something i can set in IIS or in my .NET code?
That is actually a known issue in the .Net Framework. THis is happening because the connection is being closed before you are done with it. If you are using C# add the following code to your Reference.cs file
Protected Overloads Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest Dim webRequest As HttpWebRequest = DirectCast(MyBase.GetWebRequest(uri), HttpWebRequest)
webRequest.KeepAlive = False webRequest.ProtocolVersion = HttpVersion.Version10 Return webRequest End Function
Thanks for the quick response but if i have 'Unlimited' check for the connection under IIS/Web site property for the Web service server AND app server, i shouldn't have to set the KeepAlive to false?
What is happening to you is a known issue, and you can do all the settings you like in IIS and it isn't going to stop what is happening The only way to stop it, as of right now, is the code I provided for you. Microsoft claims they are working towards a permanent solution, but don't hold your breath
I want to add an override method in the reference.vb file from my Web Service project. I cannot find the file in my solution and i cannot see it even by clicking the "show all files" icon.
I searched on my C for this file and my search failed. I know this file is supposed to be auto-generated when building a project but can we access it to modify code?
I am using .NET 2003 so am i missing something to view this file?