Hi Mklapp,
Thanks for posting in the community!
From your description, you encoutered the "Access Denied 401" error when
calling an ASP.NET webservice's webmethod from a client proxy. Is the full
error message like:
"The request failed with HTTP status 401: Access Denied. " ?
If there is anything I misunderstood, please feel free to let me know.
Based on my experience, this problem is a security issue with the
Authentication on ASP.NET web app/web service. Is the Virtual directory of
the WebService's web application set as Anonymous disabled? If so, since
when Anonymous access authentication is turned off for the Web service
application('s virtual directory), all the caller applications must provide
the credentials before making any request. By default, the Web service
client proxy does not inherit the credentials of the security context where
the Web service client application is running.
To solve the problem , you may try either of the following two methods:
1. Try change the webservice's virtual directory's Anonymous access as
allowed. You may follow the below steps:
-------------------------
a. In Control Panel, double-click Administrative Tools.
b. Double-click Internet Information Services.
c. Expand Internet Information Services, and then locate the WebServiceTest
virtual directory.
d. Right-click WebServiceTest, and then click Properties.
e. Click the Directory Security tab.
f .Under Anonymous access and authentication control, click Edit.
g. In the Authentication Methods dialog box, click to select the Anonymous
access check box.
--------------------------
2. To use the Credentials property of the Web service client proxy to set
the security credentials for Web service client authentication. One way to
set the credential property is Assign the DefaultCredentials to the
Credentials property of the Web Service Proxy class to call the Web service
while Anonymous access authentication is turned off. The DefaultCredentials
property of the CredentialCache class provides system credentials of the
security context where the application is running. To do this, use the
following code:
//myProxy is the instance of a webservice class
myProxy.Credentials= System.Net.CredentialCache.DefaultCredentials;
//then call the web method
Also, all the suggestions above have been discussed in the following KB
article:
#PRB: "Access Denied" Error Message When You Call a Web Service While
Anonymous Authentication Is Turned Off
http://support.microsoft.com/?id=811318
Please check out it if you feel anything unclear. Meanwhile, if you have
any other questions, please feel free to let me know.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)