Webservices: “The request failed with HTTP status 401: Access Denied.”

I received this error recently when trying to setup web service authentication. This error shows up when anonymous authentication is not setup on IIS. To fix this error, follow the steps below.

1) Internet Information Services control panel
2) Right click your web site and select Properties
3) Select the Directory Security tab
4) Click the Edit button
5) Check off the Anonymous access checkbox
6) Click OK
7) Click Apply and OK.

Another option is to code it directly into your code. You can do this by using the credential cache.

C# Service MyService = new Service(); MyService.PreAuthenticate = true; MyService.Credentials = System.Net.CredentialCache.DefaultCredentials;

By passing the credentials into the service will allow the anonymous access to the service.

POSTED BY Divergence Hosting on Jul 22 under Uncategorized

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

1 Comment so far
  1. Moshik December 14, 2009 4:30 am

    Thanks for update, it help a lot to our development team. We were also facing the same problem for some time.

Copyright Divergence Hosting Technical Blog | Powered by WordPress | Using the GreenTech Theme

SEO Powered by Platinum SEO from Techblissonline