My Web Service can't be used by other people

Polly Anna

New member
Joined
Apr 26, 2007
Messages
4
Programming Experience
5-10
Hi,
I have a web service on my machine that works just fine. However when another user uses it, it generates the following access error -

The request failed with HTTP status 401:Access Denied.The request failed with HTTP status 401:Access Denied.

In IIS I have set the Web Service to allow Anonymous Authentication - see below
I have also put some settings in my config file - see below - which I have changed to see if it would make any difference.

Then in the code that uses the Web Service my colleague has put the following lines of code before the Web Service is used-

Dim objAbcPdf As New ABCPdfWebService.ABCPdf

With objAbcPdf
.PreAuthenticate = True
.Credentials = System.Net.CredentialCache.DefaultCredentials
.DoSomething(txtId.Text)
End With

I really would be grateful for any help on this.

Kind Regards,

Polly Anna

IIS settings -
> Right Click > Properties > Directory Security Tab > Edit Button
then checked the Anonymous Access check box, where the User name is automatically set to 'ANYONE' and a password is automatically set with the 'Allow IIS to control password' also automatically checked. Then the 'Integrated Windwos Authentication' check box is also checked.

Web config settings -

Then in my config file I have the following settings -
<authentication mode="Windows"/>
<authorization>
<allow users="*"/>
</authorization>
<identity impersonate="true"/>
 
We recently had this problem at work with one of our web services.

It turned out that when the developer copied the files to the production server he staged them on the desktop first before moving them to the appropriate folder under IIS.

When he did that then the web service files inherited the desktop user permissions instead of the IIS User. He then re-copied the files directly to the folder under IIS and it worked.

I don't know if this will resolve your problem, but it did for us.

CT
 
Hi Cavar,
thanks for the response. I haven't moved my web service at all and it is still under IIS where it was created. So, when I use it from any .Net application on my machine it works fine. Just don't know where else to look for changing permission settings.

Kind regards

Polly Anna
 
Hi Neal,

yes, we would try the code with and without those 2 lines of code. When we used the 2 lines of code we would first get an error message saying -

A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in system.dll
Additional information: The handle specified is invalid.

Then we would get the original error message -

A first chance exception of type 'system.Net.WebException' occurred in system.web.services.dll

Additional information: The request failed with HTTP status 401: Access Denied.

Kind regards,

Polly Anna
 
If your web service does not require any authentication, i.e. it is available for anonymous access AND your users can get to the web service through any firewalls, etc. without requiring authentication, all you need to call is:

My.WebServices.ServiceName.Method
 
Hi Neal,

yes, I agree with the theory, it should all work.

So therefore I must have some setting wrong somewhere, and I just don't know where to look.

Thank you for racking your brain on my behalf.

Kind regards,

Polly Anna
 
Back
Top