Asp Net Web Service 401 Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss
Asp Net 401 Unauthorized
the workings and policies of this site About Us Learn more asp net 411 about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow asp net 404 Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each
Asp Net 403
other. Join them; it only takes a minute: Sign up Error calling web service 401: Unauthorized up vote 2 down vote favorite 1 I get The request failed with HTTP status 401: Unauthorized My web service is .NET 4 running on IIS6. My client is .NET 2 running on IIS6 When I run the both client and serivce
401 Unauthorized Web Service Call
on my local host it works. When I move the service to the web server I get the above error. I have set Allow An I have tried every combination of anonymous access & integrated Windows authentication within IIS I can access the web service via a brower and call it using Web Service Studio ok, it just does not work when I call from another .NET service UPDATE I have checked that the IUSR account has NTFS file permissions and is also added in local security policy as a USER that can access the server over network. When I call from WebService Studio it makes two request first called gets back 401, then it calls again passing 'Authorization' and works. See below. So for some reason my anonymous access is not working. As when I only have anonymous access ticked and integrated Windows authentication unticked I cannot even access it from the brower Content-Type: text/xml; charset=utf-8 SOAPAction: "http://tempuri.org/HelloWorld" Host: webdev1 Content-Length: 314 Expect: 100-continue Connection: Keep-Alive Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join [iss.0088.9164] access to wsdescriptor denied them; it only takes a minute: Sign up Web Service 401: Unauthorized Error up vote 4 down vote favorite I am running a web service locally that connects to an outside server that i do not have access to. http://stackoverflow.com/questions/11241516/error-calling-web-service-401-unauthorized I keep receiving the "401: Unauthorized" error even though the test credentials are confirmed exactly correct by the admins of this web service. Do i need to adjust any IIS settings? Here is a screenshot of the error. // Webservice IdentityService ws = new IdentityService(); // Test Static Credentials string username = "twfnf"; string password = "testme99"; string domain = "testapps1"; NetworkCredential credentials = new NetworkCredential(username, password, domain); CredentialCache credCache = new CredentialCache(); credCache.Add(new Uri(ws.Url), "Basic", credentials); ws.Credentials http://stackoverflow.com/questions/8524499/web-service-401-unauthorized-error = credCache; ws.PreAuthenticate = true; ws.AuthenticateUser(); c# web-services asmx credentials share|improve this question edited Dec 16 '11 at 19:47 John Saunders 138k20175319 asked Dec 15 '11 at 17:55 the sandman 4093727 1 Is IdentityService a SOAP style web service (like WCF web services, by default) or the older .NET 2.0 ASMX web service? –Sean Hanley Dec 15 '11 at 18:01 @Sean - it's SOAP Style –the sandman Dec 15 '11 at 18:08 Could it be that "Basic" is not the auth system used? Basic doesn't use the domain property. If you try to connect to the URI in a browser with the user/pass given, does it 401 then too? –Jon Hanna Dec 15 '11 at 18:18 1 Are you using the Visual Studio generated proxy class for the service? I'm typically used to fiddling with the ClientCredentials property on a ClientBase-derived proxy class. Maybe we need to see some code from IdentityService. –Sean Hanley Dec 15 '11 at 18:20 @JonHanna - Yes, if i go to the URL and plug in those exact Login/Pass, i get authenticated. –the sandman Dec 15 '11 at 18:47 | show 5 more comments 1 Answer 1 active oldest votes up vote 6 down vote accepted Removing the following code with Basic Authentication, fixed the issue. CredentialCache credCache = new CredentialCache(); credCache.Add(new Uri(ws.Url), "Basic", credentials); Final Code Working: // Webservice Ide ASP.NET Community Standup Forums Help Home/ASP.NET Forums/Advanced ASP.NET/WCF, ASMX and other Web Services/"401 Not Authorized" error when authenticating a web service "401 Not Authorized" http://forums.asp.net/t/1050587.aspx?+401+Not+Authorized+error+when+authenticating+a+web+service error when authenticating a web service RSS 9 replies Last post Aug https://social.msdn.microsoft.com/Forums/en-US/2b28272c-e668-41c9-80ce-af4d6eadca61/401-unauthorized-only-when-using-web-service-from-aspnet-application?forum=sqlreportingservices 16, 2007 05:12 PM by BigBlueEye ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Reply Afro Blanca None 0 Points 104 Posts "401 Not Authorized" error when authenticating a web service Dec 01, 2006 03:23 asp net PM|Afro Blanca|LINK Here's the situation : I have the same asp.net 2.0 web application running on both Machine A and Machine B. On both machines, I have Integrated Windows Authentication turned on, and Anonymous Access turned off. When I hit a certain page on Machine A, it will call the web service on Machine A, and then it will 401 unauthorized web call the same web service on Machine B. Likewise, when I hit the same page on Machine B, it will call the web service on Machine B, and then it will call the same web service on Machine A. On both machines, I have an account set up for this web service to use. The username/password for Machine A is different from the username/password for Machine B. The machines are on different Active Directory domains. The websites on Machine A and Machine B use the same second-level domain, but have different subdomains. On the page that calls the webservice, I have a block of code that looks like this : try {//call the webservice on Machine A CacheMaintenance maintain = new CacheMaintenance("local.mysite.com"); maintain.Credentials = new NetworkCredential("LocalLoginName", "LocalPassword", "LocalDomain"); maintain.FlashTheCache(); maintain.Dispose(); } catch (Exception exp) { errors = "Could not flash local cache. " + General.UnrollException(exp) + " "; } try {//call the webservice on Machine B CacheMaintenance maintain = new CacheMaintenance("testlive.mysite.com"); maintain.Credentials = new NetworkCredential("TestLiveLoginName", "TestLivePassword", "TestLiveDomain"); SQL Server 2014 Express resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: 401 Unauthorized only when using web service from ASP.NET application SQL Server > SQL Server Reporting Services, Power View Question 0 Sign in to vote I have an ASP.NETweb application on one server trying to access a report server on another. When the web application tries to take any action through the web service, it receives a "401: Unauthorized" error. Both servers use Windows Server 2008, the SQL Server is running SQL 2008 (SP1). Both servers are on the same domain,but authentication is set up through a local account defined on the SQL machine (local Windows user, using Windows authentication). I can successfully access the //server/reports and //server/reportserver sites from the app server using Internet Explorerwith the credentials set up on the sql server. I can successfully authenticate & browse to //server/reportserver/reportservice2005.asmxand see the wsdl file. The problem only exists when the web app itself tries to use the SSRS web service endpoint. Kerberos is set up, but not being used for this exchange. Here is asimplified version of my code trying to do the exchange that fails with "401: Unauthorized": ReportingService2005 rs = new ReportingService2005(); rs.Url = "http://server/reportserver/reportservice2005.asmx"; CredentialCache cache = new CredentialCache(); cache.Add( new Uri(rs.Url), "Negotiate", new NetworkCredential("user", "password", "domain" )); //cache.Add( new Uri(rs.Url), "Negotiate", new NetworkCredential("user", "password")); //cache.Add( new Uri(rs.Url), "Negotiate", new NetworkCredential("domain/user", "password")); rs.Credentials = cache; SearchCondition condition = new SearchCondition(); condition.Condition = ConditionEnum.Equals; condition.ConditionSpecified = true; condition.Name = "Name"