Tutorial :The request failed with HTTP status 401: Unauthorized


I have the following error: The request failed with HTTP status 401: Unauthorized. URL:http://serverName/ReportServer/ReportService2005.asmx

I have a web application in one server and reporting service en other.both server have installed Windows 2003. The user in the crediatials is the same the I use to install reporting service and the same the Reportins service service used. Also, this user has the RSS role and is owner in the database and this user is in teh application Pool. is somethig wrong in my code? what is the way to access the reporting service web service using imporsonation?

 {                 ReportingService2005 rs = new ReportingService2005();                try              {                    rs.Url = ConfigurationSettings.AppSettings["WSRS"].ToString();                  //rs.Credentials = System.Net.CredentialCache.DefaultCredentials;                    rs.PreAuthenticate = true;                    rs.Credentials = new NetworkCredential(RS.User_Name,RS.Pass_Word,RS.Domain)                      );                      //string report = "/SampleReports/Employee Sales Summary";                  string desc = "Added by workflow automatically";                  string eventType = "TimedSubscription";                  string scheduleXml = string.Empty;                    /*ExtentionSettings Values*/                  List<ParameterValue> ExtensionSettingsparmList = new List<ParameterValue>();                  foreach (String name in colExtensionSettings.AllKeys)                  {                      ExtensionSettingsparmList.Add(new ParameterValue() { Name = name, Value = colExtensionSettings[name].ToString() });                  }                    ExtensionSettings extSettings = new ExtensionSettings();                  extSettings.ParameterValues = ExtensionSettingsparmList.ToArray(); // extensionParams;                  extSettings.Extension = "Report Server Email";                    /*Parameters Values*/                    List<ParameterValue> parameterList = new List<ParameterValue>();                    foreach (String name in colParameters.AllKeys)                  {                      parameterList.Add(new ParameterValue() { Name = name, Value = colParameters[name].ToString() });                  }                    scheduleXml = @"<ScheduleDefinition><StartDateTime>" + DateTime.Now.AddMinutes(1).ToString("s") + "</StartDateTime></ScheduleDefinition>";                  string matchData = scheduleXml;                    return rs.CreateSubscription(report, extSettings, desc, eventType, matchData, parameterList.ToArray());              }  


This looks like a configuration issue with IIS and NTLM authentication in combination with an AppPool.

This knowledge base article might be a solution:

You receive an "HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials" error message when you try to access a Web site that is part of an IIS 6.0 application pool


Application pool needs to be running under credentials that have access to website. To ensure security run app pool as a domain user you have created that has access to your database/application with proper security access.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »