Web Service HTTP 401: Access Denied Problems

D

depalau

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: Unauthorized or
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 (localhost
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

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

What is also a little confusing is the different 401 errors we get.
One web method will return the "Unauthorized" message and a different
one will return the "Access Denied". Neither of these web methods are
turning around and calling other web services, just a SQL Server using
a generic service account for database access. Each web method returns
a string (one from a typed dataset .GetXml call, other from a regular
dataset loaded into an XmlWriter and a call to .ToString() - not that
this should matter).

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
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top