views:

442

answers:

4

Hi,

I have Windows application which calls one of my WebService. I am using Windows Authentication Mode for my WebService. a)When I try to access the Web Service it throws an error- System.Net.WebException: The request failed with HTTP status 401: Access Denied. I have set And also I have switched off Anonymus Mode for the WS. only Integrated Windows Authentication is Checked.

b)When I switch off impersonate then i get the following error- Login failed for user "My Sys No\ASPNET". I think my Login id creditinals is not passed , not sure why is it so as still Windows Authentication Mode is On.

can somebody throw light on this?

A: 

I believe that when you use windows authentication in IIS, the process still runs as the usual user (e.g. ASPNET account on Win 2k and XP), and the authenticated users security token is added to the thread that is actually running the request.

Try to enable Anonymous mode first and make sure you can get it to work (i.e. ASPNET has access to all folders, etc it needs)

Grzenio
A: 

thnx for you reply. actually I am getting the above error if i switch on my anonymus mode.

Cannot open database "Dev"(my db name) requested by the login. The login failed. Login failed for user 'my sysno\IUSR_my sysno'.

I am getting the below error if i switch off my anonymus mode The remote server returned an error: (401) Unauthorized.

in the both the cases integrated windows authentication is checked. another thing is i hav set impersonate = true and authentication = Windows.

I read tht i tihnk i need to pass the creditinals if anonymous mode is off. not sure y as clr shudb eable to pass my windows id to my db(windows authentication is enabled for my db).

I m referring to asmx WS and using .NET 2.0.

A: 

Are you setting the Credentials property of your web service proxy instance ?

e.g. something like :

yourProxyObject.Credentials = System.Net.CredentialCache.DefaultCredentials;
Moe Sisko
Just to add to this. Ensure that the application or site calling the web service is also using Windows Authentication. If the calling site or app is not using Windows Authentication the service will only receive authentication tickets as ASPNET user or NT_SERVICE
Diago
A: 

How are you refering to the webservice? I had a problem where if I referred to it as http://localhost/... instead of http://servername/... it wouldn't pass the credentials to the webservice.

Also it sounds like you're hitting the webservice once you turn on anonymous access. If you grant the IUSR access to the database it may work. If so then it would seem to be a problem passing credentials.

Ryan