webservice problem: The underlying connection was closed: Unable to connect to the remote server

Discussion in 'ASP .Net Web Services' started by Frasse, Feb 10, 2004.

  1. Frasse

    Frasse Guest

    Hello All!

    I also have the unfamous error described in subject. I created the
    HelloWorld webservice simplest way by uncommenting the HelloWorld
    source. I then create a client with the following code


    Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click

    Dim ws As New Service1
    Try
    MsgBox(ws.HelloWorld())
    Catch ex As Exception
    MsgBox(ex.ToString())
    End Try

    End Sub
    End Class


    I then place the HelloWorld.EXE in wwwroot and executes the EXE from
    another PC on intranet with a URL like "http://pc165/HelloWorld.EXE".
    The client fails with exception:

    System.Net.WebException: The underlying connection was closed: Unable
    to connect to the remote server.
    at System.Net.HttpWebRequest.CheckFinalStatus()
    at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult
    asyncResult)
    at System.Net.HttpWebRequest.GetRequestStream()
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
    methodName, Object[] parameters)
    at HelloWorld.localhost.Service1.HelloWorld()
    at HelloWorld.Form1.Button1_Click(Object sender, EventArgs e)


    Please help, Im really stuck on this one!
    Frasse, Feb 10, 2004
    #1
    1. Advertising

  2. Frasse

    Jan Tielens Guest

    How did you create the web reference, if you created it using the url
    http://localhost/xxx/service.asmx the problem could be that if you run the
    app from another computer, it tries to find the webserive on that computer
    too. To solve this you could change the localhost part with the name of the
    server the web service is located. Or you can set the URLBehavior of the web
    reference to dynamic, so the settings are stored in the app.config.

    --
    Greetz

    Jan Tielens
    ________________________________
    Read my weblog: http://weblogs.asp.net/jan


    "Frasse" <> wrote in message
    news:...
    > Hello All!
    >
    > I also have the unfamous error described in subject. I created the
    > HelloWorld webservice simplest way by uncommenting the HelloWorld
    > source. I then create a client with the following code
    >
    >
    > Public Class Form1
    > Inherits System.Windows.Forms.Form
    >
    > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Button1.Click
    >
    > Dim ws As New Service1
    > Try
    > MsgBox(ws.HelloWorld())
    > Catch ex As Exception
    > MsgBox(ex.ToString())
    > End Try
    >
    > End Sub
    > End Class
    >
    >
    > I then place the HelloWorld.EXE in wwwroot and executes the EXE from
    > another PC on intranet with a URL like "http://pc165/HelloWorld.EXE".
    > The client fails with exception:
    >
    > System.Net.WebException: The underlying connection was closed: Unable
    > to connect to the remote server.
    > at System.Net.HttpWebRequest.CheckFinalStatus()
    > at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult
    > asyncResult)
    > at System.Net.HttpWebRequest.GetRequestStream()
    > at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
    > methodName, Object[] parameters)
    > at HelloWorld.localhost.Service1.HelloWorld()
    > at HelloWorld.Form1.Button1_Click(Object sender, EventArgs e)
    >
    >
    > Please help, Im really stuck on this one!
    Jan Tielens, Feb 12, 2004
    #2
    1. Advertising

  3. Frasse

    Frasse Guest

    That's it! !!

    I thought it was enough to change the URL in the "Add Web Reference"
    dialog from "http://localhost/..." to "http://pc165/...". I now see
    that that is not the case. I must change the URL in Reference.vb
    afterwards.

    This is a big relief! Thanks Jan!


    "Jan Tielens" <> wrote in message news:<>...
    > How did you create the web reference, if you created it using the url
    > http://localhost/xxx/service.asmx the problem could be that if you run the
    > app from another computer, it tries to find the webserive on that computer
    > too. To solve this you could change the localhost part with the name of the
    > server the web service is located. Or you can set the URLBehavior of the web
    > reference to dynamic, so the settings are stored in the app.config.
    >
    > --
    > Greetz
    >
    > Jan Tielens
    > ________________________________
    > Read my weblog: http://weblogs.asp.net/jan
    >
    >
    > "Frasse" <> wrote in message
    > news:...
    > > Hello All!
    > >
    > > I also have the unfamous error described in subject. I created the
    > > HelloWorld webservice simplest way by uncommenting the HelloWorld
    > > source. I then create a client with the following code
    > >
    > >
    > > Public Class Form1
    > > Inherits System.Windows.Forms.Form
    > >
    > > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles Button1.Click
    > >
    > > Dim ws As New Service1
    > > Try
    > > MsgBox(ws.HelloWorld())
    > > Catch ex As Exception
    > > MsgBox(ex.ToString())
    > > End Try
    > >
    > > End Sub
    > > End Class
    > >
    > >
    > > I then place the HelloWorld.EXE in wwwroot and executes the EXE from
    > > another PC on intranet with a URL like "http://pc165/HelloWorld.EXE".
    > > The client fails with exception:
    > >
    > > System.Net.WebException: The underlying connection was closed: Unable
    > > to connect to the remote server.
    > > at System.Net.HttpWebRequest.CheckFinalStatus()
    > > at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult
    > > asyncResult)
    > > at System.Net.HttpWebRequest.GetRequestStream()
    > > at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
    > > methodName, Object[] parameters)
    > > at HelloWorld.localhost.Service1.HelloWorld()
    > > at HelloWorld.Form1.Button1_Click(Object sender, EventArgs e)
    > >
    > >
    > > Please help, Im really stuck on this one!
    Frasse, Feb 12, 2004
    #3
  4. Frasse

    Jan Tielens Guest

    You're welcome! :)

    --
    Greetz

    Jan Tielens
    ________________________________
    Read my weblog: http://weblogs.asp.net/jan


    "Frasse" <> wrote in message
    news:...
    > That's it! !!
    >
    > I thought it was enough to change the URL in the "Add Web Reference"
    > dialog from "http://localhost/..." to "http://pc165/...". I now see
    > that that is not the case. I must change the URL in Reference.vb
    > afterwards.
    >
    > This is a big relief! Thanks Jan!
    >
    >
    > "Jan Tielens" <> wrote in message

    news:<>...
    > > How did you create the web reference, if you created it using the url
    > > http://localhost/xxx/service.asmx the problem could be that if you run

    the
    > > app from another computer, it tries to find the webserive on that

    computer
    > > too. To solve this you could change the localhost part with the name of

    the
    > > server the web service is located. Or you can set the URLBehavior of the

    web
    > > reference to dynamic, so the settings are stored in the app.config.
    > >
    > > --
    > > Greetz
    > >
    > > Jan Tielens
    > > ________________________________
    > > Read my weblog: http://weblogs.asp.net/jan
    > >
    > >
    > > "Frasse" <> wrote in message
    > > news:...
    > > > Hello All!
    > > >
    > > > I also have the unfamous error described in subject. I created the
    > > > HelloWorld webservice simplest way by uncommenting the HelloWorld
    > > > source. I then create a client with the following code
    > > >
    > > >
    > > > Public Class Form1
    > > > Inherits System.Windows.Forms.Form
    > > >
    > > > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    > > > System.EventArgs) Handles Button1.Click
    > > >
    > > > Dim ws As New Service1
    > > > Try
    > > > MsgBox(ws.HelloWorld())
    > > > Catch ex As Exception
    > > > MsgBox(ex.ToString())
    > > > End Try
    > > >
    > > > End Sub
    > > > End Class
    > > >
    > > >
    > > > I then place the HelloWorld.EXE in wwwroot and executes the EXE from
    > > > another PC on intranet with a URL like "http://pc165/HelloWorld.EXE".
    > > > The client fails with exception:
    > > >
    > > > System.Net.WebException: The underlying connection was closed: Unable
    > > > to connect to the remote server.
    > > > at System.Net.HttpWebRequest.CheckFinalStatus()
    > > > at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult
    > > > asyncResult)
    > > > at System.Net.HttpWebRequest.GetRequestStream()
    > > > at

    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
    > > > methodName, Object[] parameters)
    > > > at HelloWorld.localhost.Service1.HelloWorld()
    > > > at HelloWorld.Form1.Button1_Click(Object sender, EventArgs e)
    > > >
    > > >
    > > > Please help, Im really stuck on this one!
    Jan Tielens, Feb 13, 2004
    #4
    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. Marisha
    Replies:
    0
    Views:
    1,212
    Marisha
    Mar 27, 2006
  2. Monty
    Replies:
    3
    Views:
    4,092
    Monty
    Sep 29, 2006
  3. Ilya
    Replies:
    0
    Views:
    129
  4. Tom McDonald
    Replies:
    1
    Views:
    164
    Tom McDonald
    Dec 20, 2003
  5. David Jeff
    Replies:
    1
    Views:
    272
    Jan Tielens
    Jan 2, 2004
Loading...

Share This Page