underlying connection was closed

Discussion in 'ASP .Net Web Services' started by simon, Jan 14, 2004.

  1. simon

    simon Guest

    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
    simon, Jan 14, 2004
    #1
    1. Advertising

  2. simon

    Trebek Guest

    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" <> wrote in message
    news:Onz#...
    > 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
    >
    >
    >
    >
    Trebek, Jan 27, 2004
    #2
    1. Advertising

  3. simon

    Simon Guest

    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" <> wrote in message
    news:4016f7b9$0$15622$...
    > 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" <> wrote in message
    > news:Onz#...
    > > 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
    > >
    > >
    > >
    > >

    >
    >
    Simon, Jan 28, 2004
    #3
  4. simon

    Trebek Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:4016f7b9$0$15622$...
    > > 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" <> wrote in message
    > > news:Onz#...
    > > > 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
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Trebek, Jan 28, 2004
    #4
  5. simon

    Simon Guest

    Thanks Alex, works well


    "Trebek" <> wrote in message
    news:4017b11c$0$15631$...
    > 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > > news:4016f7b9$0$15622$...
    > > > 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" <> wrote in message
    > > > news:Onz#...
    > > > > 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
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Simon, Jan 30, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sumit

    Underlying connection was closed

    sumit, Nov 1, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    368
    sumit
    Nov 1, 2003
  2. Steven Cheng[MSFT]
    Replies:
    4
    Views:
    1,656
    Steven Cheng[MSFT]
    Apr 8, 2004
  3. Luis Esteban Valencia
    Replies:
    0
    Views:
    404
    Luis Esteban Valencia
    Oct 26, 2004
  4. Jack Wright
    Replies:
    3
    Views:
    1,846
    Jack Wright
    Dec 6, 2004
  5. Apu Nahasapeemapetilon

    Established connection aborted and underlying connection closed

    Apu Nahasapeemapetilon, Nov 6, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    198
    Apu Nahasapeemapetilon
    Nov 6, 2006
Loading...

Share This Page