请求失败,HTTP状态为401:未授权

时间:2023-02-02 08:17:58

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

我有以下错误:请求失败,HTTP状态401:未经授权。网址: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?

我在一个服务器上有一个Web应用程序,在另一个服务器上有报告服务。两个服务器都安装了Windows 2003.信任中的用户与我用来安装报告服务的用户相同,并且使用的是相同的Reportins服务。此外,此用户具有RSS角色并且是数据库中的所有者,并且此用户位于应用程序池中。我的代码中有些错误吗?使用imporsonation访问报告服务Web服务的方法是什么?

 {

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

2 个解决方案

#1


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

这看起来像是IIS和NTLM身份验证与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

当您尝试访问属于IIS 6.0应用程序池的网站时收到“HTTP错误401.1 - 未经授权:由于凭据无效而拒绝访问”错误消息

#2


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.

应用程序池需要在可以访问网站的凭据下运行。确保安全性将应用程序池作为您创建的域用户运行,该用户可以访问具有适当安全访问权限的数据库/应用程序。

#1


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

这看起来像是IIS和NTLM身份验证与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

当您尝试访问属于IIS 6.0应用程序池的网站时收到“HTTP错误401.1 - 未经授权:由于凭据无效而拒绝访问”错误消息

#2


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.

应用程序池需要在可以访问网站的凭据下运行。确保安全性将应用程序池作为您创建的域用户运行,该用户可以访问具有适当安全访问权限的数据库/应用程序。