Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'(]

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

0
shawais
12/5/2007 6:18:39 PM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

4 Replies
1463 Views

Similar Articles

[PageSpeed] 53

There are several things you need to verify.

  1. Does the web service you are trying to access allow Anonymous Access? Authentication can be tricky for web-to-web calls
  2. What is the web application running under, IWAM_xxx or IUSR_xxx? Or are you using an application pool running under a specific identity?
  3. You may want to make sure your web application server's ASPNET or NETWORK SERVICE accounts can access your web service server.

Hopefully this points you in the right direction.


Mark Doyle
Doyle ITS
www.doyleits.com
0
doyleits
12/5/2007 7:17:11 PM

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

0
shawais
12/5/2007 7:42:19 PM

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.


Mark Doyle
Doyle ITS
www.doyleits.com
0
doyleits
12/6/2007 5:40:24 PM
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. 

 

0
wwwaspnet1234
10/3/2008 2:46:29 PM
Reply:

Similar Artilces:

System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
Hello, I hope you can help me. All Ive been trying to do for the last month is set up a test Web Service but Ive seemed to have run into problems every step of the way; from hardware set ups to authentication setting etc. Okay, I have a Web Service (TestWebService in IIS) that makes a connection to SQL Database. I also have an ASP.Net consumer page (TestWebServiceConsumer in IIS) that displays the content of the database in a GridView on a Button event. Both work fine by themselves, both are set to use ASP.net 2, Annoymonous: IUSR & Intergreated Windows Authentication. Both ar...

System.Net.WebException: The request failed with HTTP status 401: Unauthorized
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.Requ...

The request failed with HTTP status 401: Unauthorized (Exception in webservice)
 hi I am trying to invoke web method through console application in C#. The service requires Basic type of authentication in order to access methods in web service.For this I pass credentials to the webservice which consist of username, password and domain. I have added WebReference of the service URL in my console application and create an object(named proxy) of it  The problem , on invoking the web method an exception generated which states The request failed with HTTP status 401: Unauthorized . If i access the web service url in the webservice and pass username and password...

System.Net.WebException: The request failed with HTTP status 403: Access Forbidden
 Hi,    In My Asp.NET Application i am using a web service (MainWebservice) which further call another webservice(ChildWebService) for first two call its works fine but after third call i am geting this exception from ChildWebService [5556]ERROR PortalServices.ServiceImplementation.CampaignManagement [(null)] - The request failed with HTTP status 403: Access Forbidden. System.Net.WebException: The request failed with HTTP status 403: Access Forbidden. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage m...

system.Net.WebException: The request failed with HTTP status 405: Method Not Allowed. Error in Calling Web Service Function
Hello Friends, I am using a web service to get availability information. i have only following url http://webservices.micros.com/ows/5.1/Availability.wsdl I added Web References to the VS 2008 project , then i tried C# proxy class created from wsdl tool But when i am calling any function from code it gives following error system.Net.WebException: The request failed with HTTP status 405: Method Not Allowed. Please check the following page http://go-dev.com/clients/newyorkerhotelTest/reservations.aspx And click the Check Availability Button. Please tell me what...

Exception Details: System.Net.WebException: The remote name could not be resolved: 'www.webservicex.net'
Hi , i gota error weni sued webservice the exception details is given as subject and here a giving the code i hav written i am beginner so pls help me out in this public partial class Weather : System.Web.UI.Page {string City; string Country;StockQuote stock = new StockQuote();  GlobalWeather oObj = new GlobalWeather();   string var;protected void Page_Load(object sender, EventArgs e) {       }protected void btnGo_Click(object sender, EventArgs e) {  var= stock.GetQuote("GVK");this.Response.Write("myQuote='" + var ...

i ve got System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, failed. exception
hi everyone i created windows form user control and i embedded it to asp.net web for , my user control sends mail using by System.Net.Mail library but when i open my web site and click to send button that on my user control  i ve got this exception System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.    what can i do ? my best regards ..    Couple of questions: 1) Are you running this from an IIS installati...

SSRS WebService: The request failed with HTTP status 401: Unauthorized.
Hi guys, We’re having a login/security problem with the Reporting Services Web Service. We’re calling the SSRS Web Services from an ASP.NET page to fill up a tree view with the list of reports that the user can access. The reporting services server is on Machine A. When I call the page from my local IIS server (LocalHost) everything is working but I soon as I deploy the page on the Web Server (also Machine A) I received this error: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.   at System.Web.Services.Protocols.SoapHttpClie...

Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed
hi,   Am getting this error   Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed   can Any body help Code /**********************************************************/string strNewValue; string strResponse;string strFormValues = ""; ; // Create the request objHttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://someur.com/page.aspx"); // Set values for the request backreq.Method = "POST"; req.ContentType = "application...

Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
How do I solve this problem in PB105 Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Some context would be useful. We have no idea what you're doing when you get this message. Also, try to not respond to your own message. That can (and in this case did) give people who are scanning the newsgroups the impression that your question has already been answered. On 9 May 2006 07:53:22 -0700, Nico Stylemans wrote: >How do I solve this problem in PB105 > >Reque...

Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. #2
How do you solve this problem in pb105 ? Request for the permission of type 'System.Net.WebPermission,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. ...

Value of type 'System.Net.Mail.MailMessage' cannot be converted to 'System.Net.Mail.AlternateView'
Trying to create an alternateview to send a txt email with the html formatted email.  I've used string builder to create the whole email, but I get this error.  Any ideas why?  i've bolded the line that throws the error... Dim EmailBodyTxt As New StringBuilder EmailBodyTxt.Append("<html><style type='text/css'>.table{border:solid; border-color:#006666; width:600;} ")EmailBodyTxt.Append("<body><table class='table'><tr><td colspan='2'><h1>Test<br />RESPONSE SYSTEM</h1></td>...

i got 'System.Net.WebException: HTTP 405: Method not allowed'.
hi everyone i create a web service and i reference it my web site and i deployed them to windows xp iis service  when i call my web site from remote machine  and invoke webservice using submit button i got this exception i try web site and webservice in local machine it works great . how can i solve this problem ??   are you using POST to send data to the web service? perhaps where its hosted does not allow POSTS to their infastructure.  check this link : http://www.checkupdown.com/status/E405.html hth, mcm yes i send data with web service , i installe...

System.Net.Mail is giving error CS0029: Cannot implicitly convert type 'string' to 'System.Net.Mail.MailAddress'
I'm getting an error while trying to use the wizard to create a form and than pass it the vaibles to Mail. Any help would be much appreciated. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try {   message.From = txtEmail.Text; message.To.Add("admin1@yoursite.com"); message.Subject = "Feedback"; message.CC.Add("admin1@yoursite.com"); message.CC.Add("admin2@yoursite.com"); message.IsBodyHtml = false; message.Body = txtMessage.Text; smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lbl...

Web resources about - Exception::System.Net.WebException: The request failed with HTTP status 401: Unauthorized [:'(] - asp.net.networking-webservices

Resources last updated: 1/1/2016 11:49:21 PM