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

H

hufaunder

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 "
 
K

Kristofer Gafvert

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)?
 
B

bruce barker \(sqlwork.com\)

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


-- bruce (sqlwork.com)
 
H

hufaunder

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 said:
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


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 "
 
S

Swanagon, John M \(John\)

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.
(e-mail address removed)
 
H

hufaunder

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 said:
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.
(e-mail address removed)

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 "
 
S

Swanagon, John M \(John\)

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

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 said:
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.
(e-mail address removed)

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 "
 
H

hufaunder

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 said:
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

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 said:
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.
(e-mail address removed)

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 "
 
S

Swanagon, John M \(John\)

Sure, will do. I will post here in a little bit.

John

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 said:
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

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.
(e-mail address removed)

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 "
 
Joined
May 10, 2007
Messages
1
Reaction score
0
"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:
 

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

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top