No connection could be made because the target machine actively refused it

Discussion in 'ASP .Net' started by hufaunder@yahoo.com, Jul 24, 2006.

  1. Guest

    I have a website that consumes a webservice. Both of them are in the
    Default Website folder. I can execute the service without any problem
    when I go to the test page http://localhost/Service.asmx. When I try to
    consume that webservice from the website I get the error shown bellow.
    In my web.config I have:

    <authentication mode="Windows"/>
    <identity impersonate="true" userName="auser" password="apwd"/>

    IIS is configured as "Integrated Windows authentication" and "Enable
    anonymous access" is disabled.

    System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    "auser".

    I am struggling with that for a LONG time so any help is greatly
    appreciated.

    Thanks

    Error:

    "No connection could be made because the target machine actively
    refused it
    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.Sockets.SocketException: No connection
    could be made because the target machine actively refused it

    Line 110: object[] results = this.Invoke("MyWebservice", new
    object[] {

    Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    Line: 110 "
    , Jul 24, 2006
    #1
    1. Advertising

  2. Since it works locally, we can almost rule out a problem with IIS. But can
    you please verify that IIS binds to the IP address that you are trying to
    connect to from a remote machine?

    Is it possible that you have a firewall enabled (Windows XP's or a
    third-party firewall) that could be blocking remote requests on port 80
    (assuming that is the port you use)?


    --
    Regards,
    Kristofer Gafvert
    http://www.gafvert.info/iis/ - IIS Related Info


    wrote:

    >I have a website that consumes a webservice. Both of them are in the
    >Default Website folder. I can execute the service without any problem
    >when I go to the test page http://localhost/Service.asmx. When I try to
    >consume that webservice from the website I get the error shown bellow.
    >In my web.config I have:
    >
    ><authentication mode="Windows"/>
    ><identity impersonate="true" userName="auser" password="apwd"/>
    >
    >IIS is configured as "Integrated Windows authentication" and "Enable
    >anonymous access" is disabled.
    >
    >System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    >"auser".
    >
    >I am struggling with that for a LONG time so any help is greatly
    >appreciated.
    >
    >Thanks
    >
    >Error:
    >
    >"No connection could be made because the target machine actively
    >refused it
    >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.Sockets.SocketException: No connection
    >could be made because the target machine actively refused it
    >
    >Line 110: object[] results = this.Invoke("MyWebservice", new
    >object[] {
    >
    >Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    >ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    >Line: 110 "
    Kristofer Gafvert, Jul 24, 2006
    #2
    1. Advertising

  3. local accounts generally do not have network access. you should use a domain
    account.


    -- bruce (sqlwork.com)

    <> wrote in message
    news:...
    >I have a website that consumes a webservice. Both of them are in the
    > Default Website folder. I can execute the service without any problem
    > when I go to the test page http://localhost/Service.asmx. When I try to
    > consume that webservice from the website I get the error shown bellow.
    > In my web.config I have:
    >
    > <authentication mode="Windows"/>
    > <identity impersonate="true" userName="auser" password="apwd"/>
    >
    > IIS is configured as "Integrated Windows authentication" and "Enable
    > anonymous access" is disabled.
    >
    > System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    > "auser".
    >
    > I am struggling with that for a LONG time so any help is greatly
    > appreciated.
    >
    > Thanks
    >
    > Error:
    >
    > "No connection could be made because the target machine actively
    > refused it
    > 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.Sockets.SocketException: No connection
    > could be made because the target machine actively refused it
    >
    > Line 110: object[] results = this.Invoke("MyWebservice", new
    > object[] {
    >
    > Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    > ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    > Line: 110 "
    >
    bruce barker \(sqlwork.com\), Jul 24, 2006
    #3
  4. Guest

    Thanks for the reply. Actually, I cannot connect even on my local
    machine. If I go to the test site of the webservice it works
    (http://localhost/Service.asmx) but http://localhost/MyWebservice.aspx
    which uses the webservice does not.

    Thanks

    Kristofer Gafvert wrote:
    > Since it works locally, we can almost rule out a problem with IIS. But can
    > you please verify that IIS binds to the IP address that you are trying to
    > connect to from a remote machine?
    >
    > Is it possible that you have a firewall enabled (Windows XP's or a
    > third-party firewall) that could be blocking remote requests on port 80
    > (assuming that is the port you use)?
    >
    >
    > --
    > Regards,
    > Kristofer Gafvert
    > http://www.gafvert.info/iis/ - IIS Related Info
    >
    >
    > wrote:
    >
    > >I have a website that consumes a webservice. Both of them are in the
    > >Default Website folder. I can execute the service without any problem
    > >when I go to the test page http://localhost/Service.asmx. When I try to
    > >consume that webservice from the website I get the error shown bellow.
    > >In my web.config I have:
    > >
    > ><authentication mode="Windows"/>
    > ><identity impersonate="true" userName="auser" password="apwd"/>
    > >
    > >IIS is configured as "Integrated Windows authentication" and "Enable
    > >anonymous access" is disabled.
    > >
    > >System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    > >"auser".
    > >
    > >I am struggling with that for a LONG time so any help is greatly
    > >appreciated.
    > >
    > >Thanks
    > >
    > >Error:
    > >
    > >"No connection could be made because the target machine actively
    > >refused it
    > >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.Sockets.SocketException: No connection
    > >could be made because the target machine actively refused it
    > >
    > >Line 110: object[] results = this.Invoke("MyWebservice", new
    > >object[] {
    > >
    > >Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    > >ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    > >Line: 110 "
    , Jul 24, 2006
    #4
  5. What is your IIS configuration look like? Is Anonymous access disabled? IE
    is probably doing the NTLM authentication automatically. The website won't
    do that. Try disabling integrated authentication on IIS itself and enable
    only Anonymous access. I'd bet that fixes the problem. Hope this helps.

    Sincerely,
    John Swanagon
    Sr. Software Engineer, Avaya Labs
    Avaya Inc.


    <> wrote in message
    news:...
    >I have a website that consumes a webservice. Both of them are in the
    > Default Website folder. I can execute the service without any problem
    > when I go to the test page http://localhost/Service.asmx. When I try to
    > consume that webservice from the website I get the error shown bellow.
    > In my web.config I have:
    >
    > <authentication mode="Windows"/>
    > <identity impersonate="true" userName="auser" password="apwd"/>
    >
    > IIS is configured as "Integrated Windows authentication" and "Enable
    > anonymous access" is disabled.
    >
    > System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    > "auser".
    >
    > I am struggling with that for a LONG time so any help is greatly
    > appreciated.
    >
    > Thanks
    >
    > Error:
    >
    > "No connection could be made because the target machine actively
    > refused it
    > 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.Sockets.SocketException: No connection
    > could be made because the target machine actively refused it
    >
    > Line 110: object[] results = this.Invoke("MyWebservice", new
    > object[] {
    >
    > Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    > ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    > Line: 110 "
    >
    Swanagon, John M \(John\), Jul 24, 2006
    #5
  6. Guest

    My IIS configuration is "Integrated Windows authentication" and "Enable

    anonymous access" is disabled. The reason I am using impersonation is
    because I need the additional access rights.

    Swanagon, John M (John) wrote:
    > What is your IIS configuration look like? Is Anonymous access disabled? IE
    > is probably doing the NTLM authentication automatically. The website won't
    > do that. Try disabling integrated authentication on IIS itself and enable
    > only Anonymous access. I'd bet that fixes the problem. Hope this helps.
    >
    > Sincerely,
    > John Swanagon
    > Sr. Software Engineer, Avaya Labs
    > Avaya Inc.
    >
    >
    > <> wrote in message
    > news:...
    > >I have a website that consumes a webservice. Both of them are in the
    > > Default Website folder. I can execute the service without any problem
    > > when I go to the test page http://localhost/Service.asmx. When I try to
    > > consume that webservice from the website I get the error shown bellow.
    > > In my web.config I have:
    > >
    > > <authentication mode="Windows"/>
    > > <identity impersonate="true" userName="auser" password="apwd"/>
    > >
    > > IIS is configured as "Integrated Windows authentication" and "Enable
    > > anonymous access" is disabled.
    > >
    > > System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    > > "auser".
    > >
    > > I am struggling with that for a LONG time so any help is greatly
    > > appreciated.
    > >
    > > Thanks
    > >
    > > Error:
    > >
    > > "No connection could be made because the target machine actively
    > > refused it
    > > 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.Sockets.SocketException: No connection
    > > could be made because the target machine actively refused it
    > >
    > > Line 110: object[] results = this.Invoke("MyWebservice", new
    > > object[] {
    > >
    > > Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    > > ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    > > Line: 110 "
    > >
    , Jul 24, 2006
    #6
  7. Ah, got it. Then, in that case, all you need to do is authenticate to the
    webserver before your site will be able to access the web service. I
    believe it would involve providing the correct headers telling the server to
    use NTLM authentication. Since your website is using impersonation, the
    context for NTLM should exist in order for it to work properly. I don't
    know the code right off-hand, but if you want, I could write something up
    and post it here. Just let me know...

    Thanks,
    John

    <> wrote in message
    news:...
    > My IIS configuration is "Integrated Windows authentication" and "Enable
    >
    > anonymous access" is disabled. The reason I am using impersonation is
    > because I need the additional access rights.
    >
    > Swanagon, John M (John) wrote:
    >> What is your IIS configuration look like? Is Anonymous access disabled?
    >> IE
    >> is probably doing the NTLM authentication automatically. The website
    >> won't
    >> do that. Try disabling integrated authentication on IIS itself and
    >> enable
    >> only Anonymous access. I'd bet that fixes the problem. Hope this helps.
    >>
    >> Sincerely,
    >> John Swanagon
    >> Sr. Software Engineer, Avaya Labs
    >> Avaya Inc.
    >>
    >>
    >> <> wrote in message
    >> news:...
    >> >I have a website that consumes a webservice. Both of them are in the
    >> > Default Website folder. I can execute the service without any problem
    >> > when I go to the test page http://localhost/Service.asmx. When I try to
    >> > consume that webservice from the website I get the error shown bellow.
    >> > In my web.config I have:
    >> >
    >> > <authentication mode="Windows"/>
    >> > <identity impersonate="true" userName="auser" password="apwd"/>
    >> >
    >> > IIS is configured as "Integrated Windows authentication" and "Enable
    >> > anonymous access" is disabled.
    >> >
    >> > System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    >> > "auser".
    >> >
    >> > I am struggling with that for a LONG time so any help is greatly
    >> > appreciated.
    >> >
    >> > Thanks
    >> >
    >> > Error:
    >> >
    >> > "No connection could be made because the target machine actively
    >> > refused it
    >> > 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.Sockets.SocketException: No connection
    >> > could be made because the target machine actively refused it
    >> >
    >> > Line 110: object[] results = this.Invoke("MyWebservice", new
    >> > object[] {
    >> >
    >> > Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    >> > ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    >> > Line: 110 "
    >> >

    >
    Swanagon, John M \(John\), Jul 24, 2006
    #7
  8. Guest

    If you could show me some code that leads me in the right direction
    that would be very much appreciated. I'm a novice with this stuff and
    really didn't get a good grip on authentication yet.

    Thanks

    Swanagon, John M (John) wrote:
    > Ah, got it. Then, in that case, all you need to do is authenticate to the
    > webserver before your site will be able to access the web service. I
    > believe it would involve providing the correct headers telling the server to
    > use NTLM authentication. Since your website is using impersonation, the
    > context for NTLM should exist in order for it to work properly. I don't
    > know the code right off-hand, but if you want, I could write something up
    > and post it here. Just let me know...
    >
    > Thanks,
    > John
    >
    > <> wrote in message
    > news:...
    > > My IIS configuration is "Integrated Windows authentication" and "Enable
    > >
    > > anonymous access" is disabled. The reason I am using impersonation is
    > > because I need the additional access rights.
    > >
    > > Swanagon, John M (John) wrote:
    > >> What is your IIS configuration look like? Is Anonymous access disabled?
    > >> IE
    > >> is probably doing the NTLM authentication automatically. The website
    > >> won't
    > >> do that. Try disabling integrated authentication on IIS itself and
    > >> enable
    > >> only Anonymous access. I'd bet that fixes the problem. Hope this helps.
    > >>
    > >> Sincerely,
    > >> John Swanagon
    > >> Sr. Software Engineer, Avaya Labs
    > >> Avaya Inc.
    > >>
    > >>
    > >> <> wrote in message
    > >> news:...
    > >> >I have a website that consumes a webservice. Both of them are in the
    > >> > Default Website folder. I can execute the service without any problem
    > >> > when I go to the test page http://localhost/Service.asmx. When I try to
    > >> > consume that webservice from the website I get the error shown bellow.
    > >> > In my web.config I have:
    > >> >
    > >> > <authentication mode="Windows"/>
    > >> > <identity impersonate="true" userName="auser" password="apwd"/>
    > >> >
    > >> > IIS is configured as "Integrated Windows authentication" and "Enable
    > >> > anonymous access" is disabled.
    > >> >
    > >> > System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    > >> > "auser".
    > >> >
    > >> > I am struggling with that for a LONG time so any help is greatly
    > >> > appreciated.
    > >> >
    > >> > Thanks
    > >> >
    > >> > Error:
    > >> >
    > >> > "No connection could be made because the target machine actively
    > >> > refused it
    > >> > 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.Sockets.SocketException: No connection
    > >> > could be made because the target machine actively refused it
    > >> >
    > >> > Line 110: object[] results = this.Invoke("MyWebservice", new
    > >> > object[] {
    > >> >
    > >> > Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    > >> > ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    > >> > Line: 110 "
    > >> >

    > >
    , Jul 25, 2006
    #8
  9. Sure, will do. I will post here in a little bit.

    John

    <> wrote in message
    news:...
    > If you could show me some code that leads me in the right direction
    > that would be very much appreciated. I'm a novice with this stuff and
    > really didn't get a good grip on authentication yet.
    >
    > Thanks
    >
    > Swanagon, John M (John) wrote:
    >> Ah, got it. Then, in that case, all you need to do is authenticate to
    >> the
    >> webserver before your site will be able to access the web service. I
    >> believe it would involve providing the correct headers telling the server
    >> to
    >> use NTLM authentication. Since your website is using impersonation, the
    >> context for NTLM should exist in order for it to work properly. I don't
    >> know the code right off-hand, but if you want, I could write something up
    >> and post it here. Just let me know...
    >>
    >> Thanks,
    >> John
    >>
    >> <> wrote in message
    >> news:...
    >> > My IIS configuration is "Integrated Windows authentication" and "Enable
    >> >
    >> > anonymous access" is disabled. The reason I am using impersonation is
    >> > because I need the additional access rights.
    >> >
    >> > Swanagon, John M (John) wrote:
    >> >> What is your IIS configuration look like? Is Anonymous access
    >> >> disabled?
    >> >> IE
    >> >> is probably doing the NTLM authentication automatically. The website
    >> >> won't
    >> >> do that. Try disabling integrated authentication on IIS itself and
    >> >> enable
    >> >> only Anonymous access. I'd bet that fixes the problem. Hope this
    >> >> helps.
    >> >>
    >> >> Sincerely,
    >> >> John Swanagon
    >> >> Sr. Software Engineer, Avaya Labs
    >> >> Avaya Inc.
    >> >>
    >> >>
    >> >> <> wrote in message
    >> >> news:...
    >> >> >I have a website that consumes a webservice. Both of them are in the
    >> >> > Default Website folder. I can execute the service without any
    >> >> > problem
    >> >> > when I go to the test page http://localhost/Service.asmx. When I try
    >> >> > to
    >> >> > consume that webservice from the website I get the error shown
    >> >> > bellow.
    >> >> > In my web.config I have:
    >> >> >
    >> >> > <authentication mode="Windows"/>
    >> >> > <identity impersonate="true" userName="auser" password="apwd"/>
    >> >> >
    >> >> > IIS is configured as "Integrated Windows authentication" and "Enable
    >> >> > anonymous access" is disabled.
    >> >> >
    >> >> > System.Security.Principal.WindowsIdentity.GetCurrent().Name returns
    >> >> > "auser".
    >> >> >
    >> >> > I am struggling with that for a LONG time so any help is greatly
    >> >> > appreciated.
    >> >> >
    >> >> > Thanks
    >> >> >
    >> >> > Error:
    >> >> >
    >> >> > "No connection could be made because the target machine actively
    >> >> > refused it
    >> >> > 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.Sockets.SocketException: No connection
    >> >> > could be made because the target machine actively refused it
    >> >> >
    >> >> > Line 110: object[] results = this.Invoke("MyWebservice",
    >> >> > new
    >> >> > object[] {
    >> >> >
    >> >> > Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
    >> >> > ASP.NET Files\root\26676eb7\92c7e946\App_WebReferences.rglqbs34.0.cs
    >> >> > Line: 110 "
    >> >> >
    >> >

    >
    Swanagon, John M \(John\), Jul 25, 2006
    #9
  10. ytterbius

    Joined:
    May 10, 2007
    Messages:
    1
    "I have a website that consumes a webservice. Both of them are in the
    Default Website folder."

    I found this post 2 days ago, as I had the same problem. I've just now resolved it, so I thought I'd throw in my solution.

    Anonomous access and windows authentication are checked for all pages and folders.

    NTLM auth is checked.

    No changes of any of these were required, though I saw references to these things several times along the way.

    The Key (for me) was in the quoted section above. Both my web service and the consuming .aspx page were in the same default folder. This does not work.

    Instead, build a virtual directory in your wwwroot (authentication as above).

    Inside that directory, build the service (I followed these exact insructions and then copied my web service code over top of the default code: (http://support.microsoft.com/kb/813834) never mind the credential steps, I never had to go there, you may need to continue, though). (The instructions specified to "Build" the service, which I did. I don't know if it would work if you missed this step).

    Ok, Service is built in the virtual directory, take a breath or two.

    Go back to your main site (in my case, open up the site in Visual Web Dev).

    Click "Website > Add Web Reference"

    Select the appropriate service, and click through the steps. Now, VWD will build the disco, discomap, and wsdl pages for you. These refer to the web service that you've selected. However, your web.config file might also have a reference to the location of the web service, and this won't update automatically. Open any one of the automatically built reference files and copy from them the URL of the web service (in my case, http://localhost/AmericanSolarPowerCentral/YahooQuoteWebService.asmx). Paste this URL into the appropriate section of your web.config file.

    In my case, at this point my aspx was properly consuming my web service.

    :hmmmm:
    ytterbius, May 10, 2007
    #10
    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. Roxanne
    Replies:
    0
    Views:
    1,230
    Roxanne
    Jul 4, 2003
  2. gaurav tyagi
    Replies:
    0
    Views:
    5,010
    gaurav tyagi
    Mar 18, 2006
  3. Homer
    Replies:
    2
    Views:
    16,519
    Homer
    Aug 13, 2007
  4. Replies:
    8
    Views:
    233
    Swanagon, John M \(John\)
    Jul 25, 2006
  5. Merhawi Fissehaye
    Replies:
    9
    Views:
    2,530
    Simon Krahnke
    May 3, 2012
Loading...

Share This Page