【问题标题】:Reporting Services 2008: "HTTP status 401: Unauthorized" IssueReporting Services 2008:“HTTP 状态 401:未经授权”问题
【发布时间】:2011-04-18 01:36:08
【问题描述】:

每当我尝试在报告服务器上列出报告时,都会收到错误消息“请求失败,HTTP 状态 401:未经授权”。奇怪的是,当我在我的开发机器上运行 asp.net 应用程序并点击服务器报告服务 web 服务 url (http://www.example.com/reports/reportservice2005.asmx?wsdl) 但当 asp.net 应用程序安装在服务器上时(运行 iis 7)点击相同的网址我得到了错误。这是我的设置:

服务器:

SQL Server 报告服务 2008(非 R2)

网络服务网址: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>

代码背后:

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

}
}

【问题讨论】:

    标签: c# sql web-services ssrs-2008


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      我今天遇到的其他检查 - 确保检查用户的 Windows 帐户没有被锁定。这将导致对/reportserver 的请求返回401 not authorized

      【讨论】:

        猜你喜欢
        • 2020-08-12
        • 1970-01-01
        • 2010-09-21
        • 2013-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-06-30
        • 2012-11-27
        相关资源
        最近更新 更多