Welcome to Dream.In.Code
Become an Expert!

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!




Reference.vb file

2 Pages V  1 2 >  
Reply to this topicStart new topic

Reference.vb file

TheMatrix
3 Apr, 2008 - 03:20 AM
Post #1

New D.I.C Head
*

Joined: 15 Feb, 2008
Posts: 14

Hi,

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?

If you need more details, please let me know?

Thanks

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Reference.vb File
3 Apr, 2008 - 04:48 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
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


csharp

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);

webRequest.KeepAlive = false;
webRequest.ProtocolVersion=HttpVersion.Version10;
return webRequest;
}



If using VB.Net add


vb

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

User is offlineProfile CardPM
+Quote Post

TheMatrix
RE: Reference.vb File
3 Apr, 2008 - 04:59 AM
Post #3

New D.I.C Head
*

Joined: 15 Feb, 2008
Posts: 14

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?

Thanks again
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Reference.vb File
3 Apr, 2008 - 05:02 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
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 smile.gif 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 smile.gif
User is offlineProfile CardPM
+Quote Post

TheMatrix
RE: Reference.vb File
3 Apr, 2008 - 05:20 AM
Post #5

New D.I.C Head
*

Joined: 15 Feb, 2008
Posts: 14

Thanks you so much,

one more question, where do i find that reference.vb file?
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Reference.vb File
3 Apr, 2008 - 05:25 AM
Post #6

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
In your web service solution. Reference.vb is auto generated by Visual Studio, it holds the proxy class for the client side of the Web Service.

This post has been edited by PsychoCoder: 3 Apr, 2008 - 05:27 AM
User is offlineProfile CardPM
+Quote Post

TheMatrix
RE: Reference.vb File
3 Apr, 2008 - 05:34 AM
Post #7

New D.I.C Head
*

Joined: 15 Feb, 2008
Posts: 14

Sorry i cannot find it (see attach), i am using .NET 2003, could that make the difference?

Thanks
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Reference.vb File
3 Apr, 2008 - 05:36 AM
Post #8

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Im sorry, I believe the Reference.vb file is hidden by default, click the "Show All Files" button on the solution explorer and you should then see it.
User is offlineProfile CardPM
+Quote Post

TheMatrix
RE: Reference.vb File
3 Apr, 2008 - 05:39 AM
Post #9

New D.I.C Head
*

Joined: 15 Feb, 2008
Posts: 14

Already did, mmmm very weird. i even made a search on my C and did not find a name like this.

I'll probably just google this their should be something for this....
User is offlineProfile CardPM
+Quote Post

TheMatrix
RE: Reference.vb File
3 Apr, 2008 - 06:14 AM
Post #10

New D.I.C Head
*

Joined: 15 Feb, 2008
Posts: 14

Hi,

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?

Thanks

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Reference.vb File
3 Apr, 2008 - 06:18 AM
Post #11

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Please don't open a new thread for an issue thats already being worked on. Merged smile.gif
User is offlineProfile CardPM
+Quote Post

TheMatrix
RE: Reference.vb File
3 Apr, 2008 - 06:22 AM
Post #12

New D.I.C Head
*

Joined: 15 Feb, 2008
Posts: 14

Oh sorry, i thought since it was a new problem i needed to open a new thread.

Thanks
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 07:48PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month