We have an internal company WinForms application that makes some calls
out to a intranet web service (once at application start-up for some
configuration info and then periodically during the life of the
application for specific functional requests).
We are getting System.Net.WebException with HTTP 401: Access Denied
errors periodically when we are attempting some functional web service
calls. However, immediately trying the web service call again works as
expected.
I hesitate to call it random since it seems these errors occur only
after periods of inactivity, which lead me to believe we are seeing
this only after the IIS worker process gets recycled. Although I am
definitely not sure of that. Microsoft seems to have a KB article
about this (902160):
http://support.microsoft.com/default.aspx?scid=kb;en-us;902160
I really don't want to change the recycle period if I can help it and
would rather determine if there is another way around the problem (if
this is really the culprit even).
We receive these errors running against both IIS 5.1 (development
machine) and IIS 6.0.
The details:
WinForm Client
- .Net 1.1 SP 1, VB.Net
- Client web service call code:
service = New MyService
service.Credentials = System.Net.CredentialCache.DefaultCredentials
service.PreAuthenticate = True
service.DoSomething
IIS 5.1/6.0
- Anonymous Access On
- Integrated Windows Authentication On
- Defaults for all time-outs for session, scripts, worker processes,
etc.
Web Service
- .Net 1.1 SP 1, VB.Net
- Web.config: deny anonymous users, Windows authentication mode
Do our IIS and web.config file settings make sense? Is the
PreAuthenticate property an issue (does it even do anything)?
Also confusing is the fact that after the initial error, attempting the
same call will work.
Does any one have any answers or leads? Thanks in advance for any
help.
-David
RedmondScorpio - 07 Oct 2005 09:20 GMT
Hi,
We had the same problem. After setting PreAuthenticate=false, we wer
able to call web service methods without any issues.
By doing so, every request to the web service reauthenticates.
Hope that helps.
Mik
--
RedmondScorpi
David Palau - 11 Oct 2005 16:31 GMT
Yes, that was the problem. Thanks for your suggestion.