Reporting Services 2008:"HTTP状态401:未授权"问题

jmm*_*312 9 c# sql web-services ssrs-2008

每当我尝试在报告服务器上列出报告时,我收到错误"请求失败并显示HTTP状态401:未经授权".奇怪的是,当我在我的开发机器上运行asp.net应用程序到服务器报告服务Web服务URL(http://www.example.com/reports/reportservice2005.asmx?wsdl)但是当asp时.net app安装在服务器上(运行iis 7)命中相同的url我收到错误.这是我的设置:

服务器:

SQL Server Reporting Services 2008(不是R2)

Web服务网址:http://www.example.com/reports/reportservice2005.asmx?wsdl

客户

创建了一个代理ReportingServices2005.cs

Web.config有

列出报告的代码:

<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>
Run Code Online (Sandbox Code Playgroud)

代码背后:

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

}
}
Run Code Online (Sandbox Code Playgroud)

jmm*_*312 13

经过几个小时的谷歌搜索大量的论坛和文章后,我发现Windows Server中的一个名为"环回检查"(http://support.microsoft.com/kb/926642)的安全功能导致了这个问题.之所以发生这种情况,是因为我在同一台机器上同时拥有我的报表服务器和IIS服务器,而且我使用完全限定的域名(FQDN:http://www.example.com/reportserver)来访问报表.我通过简单地使用服务器的名称而不是域名即http:// mymachinename/reportserver来解决这个问题.我希望这可以帮助别人.