underlying connection was closed

S

simon

Hi,

Can anyone help me with the error msg below? It seems to occur then the
page hasn't been loaded for a while; when I refresh the page in the browser
window, it works fine. Is this a caching problem and is it a problem in the
web service provider or my app? Google and MS kb don't provide definitive
help in this regard.

Thanks, Simon



************************************************
The underlying connection was closed: An unexpected error occurred on a
send.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying connection was
closed: An unexpected error occurred on a send.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[WebException: The underlying connection was closed: An unexpected error
occurred on a send.]
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) +58

System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReques
t request) +5
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +183
rt.cc.CurrencyConvertor.ConversionRate(Currency FromCurrency, Currency
ToCurrency) in C:\Documents and
Settings\sshutter\VSWebCache\www.schemax.com\rt\Web
References\cc\Reference.cs:37
rt.currency.Page_Load(Object sender, EventArgs e) in c:\documents and
settings\sshutter\vswebcache\www.schemax.com\rt\currency.aspx.cs:27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
 
T

Trebek

Sure ... all you need to is override the GetWebRequest method of your proxy
class and set the KeepAlives to false ... Example follows:

In your proxy class, make sure to add a reference to the System.Net
assembly and then override the GetWebRequest Method as follows :
protected override WebRequest GetWebRequest(Uri uri)

{

HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);

webRequest.KeepAlive = false;

return webRequest;

}

Alex
 
S

Simon

Thanks, Alex. I'm a bit new to this technology so could you be more
specific. Am I supposed to stick the override code in the Reference.cs file
and do I need to specific the URL of the .asmx file in the code?





Trebek said:
Sure ... all you need to is override the GetWebRequest method of your proxy
class and set the KeepAlives to false ... Example follows:

In your proxy class, make sure to add a reference to the System.Net
assembly and then override the GetWebRequest Method as follows :
protected override WebRequest GetWebRequest(Uri uri)

{

HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);

webRequest.KeepAlive = false;

return webRequest;

}

Alex







simon said:
Hi,

Can anyone help me with the error msg below? It seems to occur then the
page hasn't been loaded for a while; when I refresh the page in the browser
window, it works fine. Is this a caching problem and is it a problem in the
web service provider or my app? Google and MS kb don't provide definitive
help in this regard.

Thanks, Simon



************************************************
The underlying connection was closed: An unexpected error occurred on a
send.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying connection was
closed: An unexpected error occurred on a send.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[WebException: The underlying connection was closed: An unexpected error
occurred on a send.]
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) +58
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReques
t request) +5
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +183
rt.cc.CurrencyConvertor.ConversionRate(Currency FromCurrency, Currency
ToCurrency) in C:\Documents and
Settings\sshutter\VSWebCache\www.schemax.com\rt\Web
References\cc\Reference.cs:37
rt.currency.Page_Load(Object sender, EventArgs e) in c:\documents and
settings\sshutter\vswebcache\www.schemax.com\rt\currency.aspx.cs:27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
 
T

Trebek

Simon,

Yes, this override goes in the Reference.cs file (if you are on VS2003 the
override will appear in intellisense). Make sure to add an assembly ref to
System.Net or specify the full assembly path since it will not be there be
default. With regard to the url, if you set the url property to 'dynamic',
it will appear as an entry in your service's web.config file and you can
change the url there without recompile if need be. You can, however, set
the url property thru code if you need to. I often set my url path based on
the DEBUG symbols to specify 'production' or 'development' in the code
depending on build configuration.

HTH,

Alex


Simon said:
Thanks, Alex. I'm a bit new to this technology so could you be more
specific. Am I supposed to stick the override code in the Reference.cs file
and do I need to specific the URL of the .asmx file in the code?





Trebek said:
Sure ... all you need to is override the GetWebRequest method of your proxy
class and set the KeepAlives to false ... Example follows:

In your proxy class, make sure to add a reference to the System.Net
assembly and then override the GetWebRequest Method as follows :
protected override WebRequest GetWebRequest(Uri uri)

{

HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);

webRequest.KeepAlive = false;

return webRequest;

}

Alex







simon said:
Hi,

Can anyone help me with the error msg below? It seems to occur then the
page hasn't been loaded for a while; when I refresh the page in the browser
window, it works fine. Is this a caching problem and is it a problem
in
the
web service provider or my app? Google and MS kb don't provide definitive
help in this regard.

Thanks, Simon



************************************************
The underlying connection was closed: An unexpected error occurred on a
send.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying connection was
closed: An unexpected error occurred on a send.

Source Error:

An unhandled exception was generated during the execution of the
current
web
request. Information regarding the origin and location of the
exception
can
be identified using the exception stack trace below.

Stack Trace:

[WebException: The underlying connection was closed: An unexpected error
occurred on a send.]
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) +58
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReques
t request) +5
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +183
rt.cc.CurrencyConvertor.ConversionRate(Currency FromCurrency, Currency
ToCurrency) in C:\Documents and
Settings\sshutter\VSWebCache\www.schemax.com\rt\Web
References\cc\Reference.cs:37
rt.currency.Page_Load(Object sender, EventArgs e) in c:\documents and
settings\sshutter\vswebcache\www.schemax.com\rt\currency.aspx.cs:27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
 
S

Simon

Thanks Alex, works well


Trebek said:
Simon,

Yes, this override goes in the Reference.cs file (if you are on VS2003 the
override will appear in intellisense). Make sure to add an assembly ref to
System.Net or specify the full assembly path since it will not be there be
default. With regard to the url, if you set the url property to 'dynamic',
it will appear as an entry in your service's web.config file and you can
change the url there without recompile if need be. You can, however, set
the url property thru code if you need to. I often set my url path based on
the DEBUG symbols to specify 'production' or 'development' in the code
depending on build configuration.

HTH,

Alex


Simon said:
Thanks, Alex. I'm a bit new to this technology so could you be more
specific. Am I supposed to stick the override code in the Reference.cs file
and do I need to specific the URL of the .asmx file in the code?
problem
on
a
send.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying
connection
was
closed: An unexpected error occurred on a send.

Source Error:

An unhandled exception was generated during the execution of the current
web
request. Information regarding the origin and location of the exception
can
be identified using the exception stack trace below.

Stack Trace:

[WebException: The underlying connection was closed: An unexpected error
occurred on a send.]

System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) +58
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReques
t request) +5
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +183
rt.cc.CurrencyConvertor.ConversionRate(Currency FromCurrency, Currency
ToCurrency) in C:\Documents and
Settings\sshutter\VSWebCache\www.schemax.com\rt\Web
References\cc\Reference.cs:37
rt.currency.Page_Load(Object sender, EventArgs e) in c:\documents and
settings\sshutter\vswebcache\www.schemax.com\rt\currency.aspx.cs:27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top