Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用DefaultCredentials通过asp.net页面列出Reporting Services中的报表_Asp.net_Sql Server_Reporting Services - Fatal编程技术网

无法使用DefaultCredentials通过asp.net页面列出Reporting Services中的报表

无法使用DefaultCredentials通过asp.net页面列出Reporting Services中的报表,asp.net,sql-server,reporting-services,Asp.net,Sql Server,Reporting Services,----------背景----------------- 我目前正在尝试在我们的内部网中为我们的员工构建一个Web界面。 我想建立一些沿着谎言的东西,如果他们能够 访问他们有权访问的报告,以及我们 正在构建基于部门管理不同流程的系统 我们有一个应用服务器和一个reporting services服务器(SQL 2008) ----------到目前为止我做了什么-------------------- 我已经添加了一个对 我可以看到服务列表并通过internet explorer访问它们(当我

----------背景-----------------
我目前正在尝试在我们的内部网中为我们的员工构建一个Web界面。 我想建立一些沿着谎言的东西,如果他们能够 访问他们有权访问的报告,以及我们 正在构建基于部门管理不同流程的系统

我们有一个应用服务器和一个reporting services服务器(SQL 2008)

----------到目前为止我做了什么--------------------

我已经添加了一个对 我可以看到服务列表并通过internet explorer访问它们(当我直接导航到它们时)

Web配置使用 身份验证模式:Windows 身份模拟=真

--------------问题------------------

当我尝试像这样传递用户凭据时,问题就出现了

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim res As String = "---"

    Dim rs As New ReportingService2005()

    rs.Credentials = System.Net.CredentialCache.DefaultCredentials
    Dim items As New prodrpt.CatalogItem()

    For Each item In rs.ListChildren("/", True)
        res = res + item.Name + " | " + item.Path + " | " + item.Type.ToString + "<br />"
    Next
    Response.Write(res)

    cont.InnerHtml = res
End Sub
如果替换rs.Credentials=System.Net.CredentialCache.DefaultCredentials

rs.Credentials=新系统.Net.NetworkCredential(“用户名”、“密码”)

通过直接传递我的凭据,它可以工作,但我希望它能够自动选择凭据

我还注意到,如果我输入像“域\用户名”这样的凭据,它会失败,但如果我只输入“用户名”,而不输入域,它就会工作

我不知道在这一点上尝试什么,任何帮助都将不胜感激


谢谢。

如果您在IIS上运行站点,是否会收到未经授权的消息?在内置开发服务器上运行应用程序时,它是否工作?如果仅在IIS上出现错误,我猜您必须将应用程序池标识设置为有权访问web服务的域用户。

当我从应用程序服务器运行应用程序时(IIS打开IE以浏览页面),应用程序似乎可以工作,但当我从任何其他计算机运行它时,应用程序似乎无法工作。我正在跳回此项目,注意到,它似乎只在我运行localhost时获取凭据。我发现了这个链接,它似乎指出了一个可能的原因和解决方案,但它现在有点让我不知所措,所以我需要一点阅读来测试它。
Line 925:        [return: System.Xml.Serialization.XmlArrayAttribute("CatalogItems")]
Line 926:        public CatalogItem[] ListChildren(string Item, bool Recursive) {
Line 927:            object[] results = this.Invoke("ListChildren", new object[] {
Line 928:                        Item,
Line 929:                        Recursive});


[WebException: The request failed with HTTP status 401: Unauthorized.]
   System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +412782
   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +300
   prodrpt.ReportingService2005.ListChildren(String Item, Boolean Recursive) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\e22c2559\92c7e946\App_WebReferences.nrvcuhh0.1.cs:927
   apps_Payroll_Main.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\apps\Payroll\Main.aspx.vb:16
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428