The request failed with HTTP status 401: Unauthorized

  • Thread starter Thread starter Sachin
  • Start date Start date
S

Sachin

Scenario:

Machine A: ASP.NET Web UI
IIS 6.0
Windows Server 2003
Impersonation Account: domain\Acct1


Machine B: ASP.NET Web Service
IIS 6.0
Windsow Server 2003
Impersonation Account: domain\Acct2



when Web UI calls Web Service, it fails saying "System.Web.Exception The
request failed with HTTP status 401: Unauthorized."

When I look at the IIS log for Web Service I see,

WebService.asmx -> HTTP Code, 401 2
WebService.asmx -> HTTP Code, 401 3
WebService.asmx -> HTTP Code, 401 1


domain\Acct1 has full control over web service web site and all the files
underneath it.



I used filemon on WebService.asmx and found that IIS is even not tring to
read it.


Then I deployed the same Web Service on Machine C, with similar
configuration. Web UI works fine.

Could someone please help me to find out what could be wrong?

Any pointer?

Thanks in advace
Sachin
 
either pass credentials when calling webservice, or in the webservice vdir
allow anonymous.

-- bruce (sqlwork.com)
 
I am passing Default credentials while calling the web service.

Even anonumous access is not working.

However, it works on Machine C.
 
I know this is an old thread, but for the benefit of someone that might be having the same issue, if the original thread creator managed to solve their problem...

On the computer where authentication wasn't working with Anonymous or Windows-integrated, try assigning IIS to Anonymous authentication and making sure that the IUSR_computername account (Internet Guest Account), ASPNET, and IWAM_computername all have privileges to C:\inetpub\wwwroot. If that doesn't work, try making sure the password for the Internet Guest Account matches in IIS to the one in Local Users and Groups for that account.

If that doesn't work, try deleting and re-creating the Internet Guest Account. That worked for me once when I had the same problem. Make sure you put the password into IIS just the same as you did on the account when you re-created it, though. But at least you'd know if it works under Anonymous that way. Can put just a basic HTML page there, too... Paste this into Notepad and save as test.htm into your C:\inetpub\wwwroot folder:

Code:
<html><head><title>Test</title></head><body>Test page</body></html>

If you can pull up http://localhost/test.htm, then your authentication is ok.
If not, IIS is probably corrupt & needs re-installation from Add/Remove Windows Components in Add/Remove Programs.

Hope this helps.

-Tom
 
Last edited:
Back
Top