Click here to Skip to main content
15,899,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m working on website which sends sms
i m using web service
when i run the program with visual studio i m able to send sms
i made exe of the same and trying to host the same from IIS
while running EXE , the program is unable to connect to web service and it shows the error
"
The request failed with HTTP status 401: Unauthorized.
"

i used logs to know where the problem is
till call to web service the program works fine and when web service is called at that line i get above error

I have done changes in web config and provided url of webservice also
Posted

1 solution

Try this

1. You must add <identity impersonate="true"> in Web.Config file of the web application that is calling the web service.
2. Try to use System.Net.CredentialCache.DefaultNetworkCredentials

If this does not solve your issue then follow these steps
1. Enable Anonymous access from IIS for the web service (Refer http://support.microsoft.com/kb/324274[^] for the details)
2. In case you dont have access to change the IIS Settings or you just dont want to allow anonymous because other applications are using it, then you can programatically provide the permissions by specifying the credential cache. This can be achieved by using System.Net.CredentialCache.DefaultNetworkCredentials.

Hope this helps.
All the best.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900