views:

2497

answers:

5

i have a web service hosted on another server with the Anonymous Access CheckBox in IIS is already checked. when my local web application is trying to access the web service, i still get the "The request failed with HTTP status 401: Access Denied." error. my web application is calling the web service like the following:

MyObject.WebService ws = new MyObject.WebService (); ws.Retrieve(someParams);

what am i missing here?

A: 

have you try un selecting the allow iis to control password some times that get out of sink.

try the site and it may work. you sould be able to reenable control after that

B.A.Hammer
how do you do that in IIS6?
Gnot
+6  A: 

Here is a good reference on diagnosing 401 errors.

From that, one place to start is looking at the credentials you configure for the anonymous user. If they are incorrect (if perhaps the user password was changed elsewhere) you will get an HTTP 401.

David Hall
+1 for saving me hours more work; +more if I could.
Patrick Cuff
+1  A: 

Make sure your directory permissions are also set to allow everyone read access. A lot of times doing local dev work I will forgot that the directory being accessed has a seperate set of permissions that need to be altered.

Cheers!

thismat
permission have been set
Gnot
A: 

Try the following (note the PreAuthenticate thingy):

MyObject.WebService ws = new MyObject.WebService(); 
ws.PreAuthenticate = true;
response = ws.Retrieve(someParams);

For more detailed explanation why this may work you can reference following answer here http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/3ae9753d-2d97-45b9-9ba2-6d551fe60a48/.

Vlad N
using PreAuthenticate = true doesn't work
Gnot
A: 

Hi

I think what might be happening is that you are getting a 401 - permission denied but as to whom the permission is denied to is unclear. I am guessing at this point you have checked the NTFS permissions on the machine, and have confirmed that you do have access.

Next I would look at what account the application pool uses. If it is the default setup, it will probably be the NT Network Service Account. If that is the case, confirm that the account does have access to the application directory. If that is also the case it might perhaps be a COM+ security setting. By default your network service account does not have permission to remotely launch components. If this is the case you will be seeing errors in the system and security log that will say things link, "Unable to launch component "

Looking at the IIS log files and the system and security event logs on the iis server often yield more clues.

Hope it helps Best Regards Rihan Meij

Rihan Meij