I'm getting the error "The request failed with HTTP status 401: Unauthorized" whenever I try to list the reports on my reporting server. The weird thing is, it works when I run the asp.net application on my dev machine hitting the server reporting services web service url (http://www.example.com/reports/reportservice2005.asmx?wsdl) but when the asp.net app is installed on the server (running iis 7) hitting the same url I get the error. Here's my set up:
每当我尝试在报告服务器上列出报告时,我收到错误“请求失败并显示HTTP状态401:未经授权”。奇怪的是,当我在我的开发机器上运行asp.net应用程序时,它可以运行服务器报告服务Web服务URL(http://www.example.com/reports/reportservice2005.asmx?wsdl)但是当asp .net app安装在服务器上(运行iis 7)命中相同的url我收到错误。这是我的设置:
Server:
服务器:
SQL Server Reporting services 2008 (not R2)
SQL Server Reporting Services 2008(不是R2)
Web service url: http://www.example.com/reports/reportservice2005.asmx?wsdl
Web服务网址:http://www.example.com/reports/reportservice2005.asmx?wsdl
Client
客户
Created a proxy ReportingServices2005.cs
创建了一个代理ReportingServices2005.cs
Web.config has
Web.config有
Code to list reports:
列出报告的代码:
<asp:ListView ID="lvReportList" runat="server">
<LayoutTemplate>
<ul>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<li>
<asp:HyperLink runat="server" ID="hpReportLink" NavigateUrl='<%#Eval("Url")%>'><%#Eval("Name")%></asp:HyperLink>
</li>
</ItemTemplate>
<EmptyDataTemplate>
<div>
No reports to display.
</div>
</EmptyDataTemplate>
Code Behind:
代码背后:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string rWebServiceUrl = ConfigurationManager.AppSettings["RSWebserviceUrl"];
string reportServerFolder = ConfigurationManager.AppSettings["ReportServerFolder"];
string domain = ConfigurationManager.AppSettings["RSDomain"];
string userName = ConfigurationManager.AppSettings["RSUsername"];
string password = ConfigurationManager.AppSettings["RSPassword"];
objRS.Url = rWebServiceUrl;
objRS.Credentials = new NetworkCredential(userName, password, domain);
ReportingServices2005.CatalogItem[] items = objRS.ListChildren(reportServerFolder, false);
var reportList = from p in items
select new
{
Name = p.Name,
Url = String.Format("{0}?reportPath={1}/{2}", ReportViewerUrl, reportServerFolder, p.Name)
};
lvReportList.DataSource = reportList;
lvReportList.DataBind();
}
}
2 个解决方案
#1
13
After several hours of Googling numerous forums and articles, I found that a security feature in Windows Server called "loopback check" (http://support.microsoft.com/kb/926642) was causing the issue. It happened because I have both my report server and IIS server on the same machine and I was using the fully qualified domain name (FQDN: http://www.example.com/reportserver) to access the reports. I solved this by simply using the name of the server instead of the domain name i.e http://mymachinename/reportserver. I hope this helps someone.
经过几个小时的谷歌搜索大量的论坛和文章后,我发现Windows Server中的一个名为“环回检查”(http://support.microsoft.com/kb/926642)的安全功能导致了这个问题。之所以发生这种情况,是因为我在同一台机器上同时拥有我的报表服务器和IIS服务器,并且我使用完全限定的域名(FQDN:http://www.example.com/reportserver)来访问报表。我通过简单地使用服务器的名称而不是域名来解决这个问题,即http:// mymachinename / reportserver。我希望这可以帮助别人。
#2
2
Something else to check that I ran into today - be sure to check that the user's Windows account is not locked out. This will cause requests to /reportserver
to return 401 not authorized
.
检查我今天遇到的其他事情 - 请务必检查用户的Windows帐户是否未被锁定。这将导致对/ reportserver的请求返回401未授权。
#1
13
After several hours of Googling numerous forums and articles, I found that a security feature in Windows Server called "loopback check" (http://support.microsoft.com/kb/926642) was causing the issue. It happened because I have both my report server and IIS server on the same machine and I was using the fully qualified domain name (FQDN: http://www.example.com/reportserver) to access the reports. I solved this by simply using the name of the server instead of the domain name i.e http://mymachinename/reportserver. I hope this helps someone.
经过几个小时的谷歌搜索大量的论坛和文章后,我发现Windows Server中的一个名为“环回检查”(http://support.microsoft.com/kb/926642)的安全功能导致了这个问题。之所以发生这种情况,是因为我在同一台机器上同时拥有我的报表服务器和IIS服务器,并且我使用完全限定的域名(FQDN:http://www.example.com/reportserver)来访问报表。我通过简单地使用服务器的名称而不是域名来解决这个问题,即http:// mymachinename / reportserver。我希望这可以帮助别人。
#2
2
Something else to check that I ran into today - be sure to check that the user's Windows account is not locked out. This will cause requests to /reportserver
to return 401 not authorized
.
检查我今天遇到的其他事情 - 请务必检查用户的Windows帐户是否未被锁定。这将导致对/ reportserver的请求返回401未授权。