ASP.NET Web Service Throws 401 (unauthorized) Error
Posted
by user268611
on Stack Overflow
See other posts from Stack Overflow
or by user268611
Published on 2010-04-05T08:05:46Z
Indexed on
2010/04/05
8:13 UTC
Read the original article
Hit count: 621
Hi Experts,
I have this .NET application to be run in an intranet environment. It is configured so that it requires Windows Authentication before you can access the website (Anonymous access is disabled). This website calls a web service (enable anonymous access) and the web service calls the DB. We do have a token-based authentication between the web application and the web service to secure the communication between them.
The issue I'm facing is that when I deploy this to production, I'm having an intermittent issue whereby the communication between the web application and the web service failed. The 401 issue was thrown. This is actually working fine in our QA environment. Is this an issue with Active Directory? Or could it be an isssue with FQDN as mentioned here: http://support.microsoft.com/default.aspx?scid=kb;en-us;896861?
The weirdest thing is that this is happening intermittently when tested in both on the server itself and a remote workstation in my client's environment. But, this is working perfectly in my environment.
OS: Windows Server SP1 IIS 6 .NET 3.5 Framework
Any idea about the 401 (Unauthorized) issue?? Thx for the help...
This is from the log...
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 4/5/2010 10:44:57 AM
Event time (UTC): 4/5/2010 2:44:57 AM
Event ID: 6c8ea2607b8d4e29a7f0b1c392b1cb21
Event sequence: 155112
Event occurrence: 2
Event detail code: 0
Application information:
Application domain: xxx
Trust level: Full
Application Virtual Path: xxx
Application Path: xxx
Machine name: xxx
Process information:
Process ID: 4424
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: WebException
Exception message: The request failed with HTTP status 401: Unauthorized.
Request information:
Request URL: http://[ip]/[app_path]
Request path: xxx
User host address: [ip]
User: xxx
Is authenticated: True
Authentication Type: Negotiate
Thread account name: xxx
Thread information:
Thread ID: 6
Thread account name: xxx
Is impersonating: False
Stack trace: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at wsVulnerabilityAdvisory.Service.test()
at test.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
© Stack Overflow or respective owner