Request failed with HTTP status 401: Unauthorized

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

I have a web application on the same server and a reporting service and the other.both server has Windows 2003 installed. The user in the sorts is the same thing I use to install the reporting service and the same Reportins service. In addition, this user has the RSS role and is the owner of the database, and this user is a member of the application pool. is there something wrong in my code? what is the way to access the reporting service web service using impersonation?

 {

             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());
            }

      

+1


a source to share


2 answers


It looks like a configuration issue with IIS and NTLM validation combined with AppPool.

This knowledge base article might be the solution:



When you try to access a website that you receive the error "HTTP Error 401.1 - Unauthorized: Access Denied Due to Invalid Credentials" IIS 6.0 Application Pool

+2


a source


The application pool must run under credentials that have access to the website. To ensure that the application pool runs securely as a domain user that you created that has access to your database / application with proper security access.



+1


a source







All Articles