I am trying access a webservice through my web application but i am getting this error, can you please help me to get rid of this error?
Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at FORIS.TelCRM.RequestManagement.CustomerCare.UI.RequestManagementWSAddRemoveService.AddRemoveServices.GetBalance(String InputXML)
at FORIS.TelCRM.RequestManagement.CustomerCare.UI.AddRemSHiddenForm.Page_Load(Object sender, EventArgs e)
--
<div mce_keep="true">Does the web service you are trying to access allow Anonymous Access? Authentication can be tricky for web-to-web calls</div>
<div mce_keep="true">What is the web application running under, IWAM_xxx or IUSR_xxx? Or are you using an application pool running under a specific identity?</div>
<div mce_keep="true">You may want to make sure your web application server's ASPNET or NETWORK SERVICE accounts can access your web service server.</div>
To pass credentials to the web service (actually, to IIS), you need to have the web application running under a specific identity. I tried this approach (but never was successful) by running ASP.NET under a domain account. This was supposed to work in my
intranet environment, but again, I went a different route. For public (Internet) facing web services, you'll have to stick with Anonymous Access, or use WSE (Web Services Enhancements -
http://msdn2.microsoft.com/en-us/webservices/aa740663.aspx)
Hi, I have the same problem.The web service is running on the same server where the web app. runs. I can hit the web service directly without problems. But,
when the web app which calls web service runs, I got " Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized "I checked : 1) both web service and web site have "Allow
Anonymous Access" 2) both under IUSR_xxx 3) both have ASPNet and Network service accounts access.Any idea?
Thanks a lot in advance.
how can i pass the domain user credentials to webservice and then to SQL server. user logon to website with integrated windows auth. website calls web service that is on anonymous and calles SQL server that has sa username and password. my business demands
webservice to call SQL server with the identity of the user who calls web service. cant get this done... any help will be much appriciated.
shawais
Member
229 Points
52 Posts
Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'(]
Dec 05, 2007 05:18 PM|LINK
I am trying access a webservice through my web application but i am getting this error, can you please help me to get rid of this error?
Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at FORIS.TelCRM.RequestManagement.CustomerCare.UI.RequestManagementWSAddRemoveService.AddRemoveServices.GetBalance(String InputXML)
at FORIS.TelCRM.RequestManagement.CustomerCare.UI.AddRemSHiddenForm.Page_Load(Object sender, EventArgs e)
--
Thanks
Awais
doyleits
Contributor
3580 Points
549 Posts
Re: Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'...
Dec 05, 2007 06:17 PM|LINK
There are several things you need to verify.
Hopefully this points you in the right direction.
Collabroscape LLC [www.collabroscape.com]
shawais
Member
229 Points
52 Posts
Re: Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'...
Dec 05, 2007 06:42 PM|LINK
Thank you so much for your answer and support.
Your reply was really helpful to solve this issue. I have provided an account for Anonymous Access and then it is working.
Can you please tell me that how can I give credentials to webservice instead of allowing Anonymous Access???
Thanks
Awais
doyleits
Contributor
3580 Points
549 Posts
Re: Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'...
Dec 06, 2007 04:40 PM|LINK
To pass credentials to the web service (actually, to IIS), you need to have the web application running under a specific identity. I tried this approach (but never was successful) by running ASP.NET under a domain account. This was supposed to work in my intranet environment, but again, I went a different route. For public (Internet) facing web services, you'll have to stick with Anonymous Access, or use WSE (Web Services Enhancements - http://msdn2.microsoft.com/en-us/webservices/aa740663.aspx)
I'm glad your first issue was resolved.
Collabroscape LLC [www.collabroscape.com]
wwwaspnet123...
Member
2 Points
1 Post
Re: Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'...
Oct 03, 2008 02:46 PM|LINK
yawarasp
Member
2 Points
1 Post
Re: Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'...
Aug 12, 2009 11:23 AM|LINK
Hello doyle,
how can i pass the domain user credentials to webservice and then to SQL server. user logon to website with integrated windows auth. website calls web service that is on anonymous and calles SQL server that has sa username and password. my business demands webservice to call SQL server with the identity of the user who calls web service. cant get this done... any help will be much appriciated.
regards
yawar