【问题标题】:Getting the ssrs webservice from any given url?从任何给定的 url 获取 ssrs 网络服务?
【发布时间】:2013-10-01 20:25:34
【问题描述】:

所以我不能在我的项目中引用任何特定的 SSRS Web 服务,因为我希望用户能够将它指向他们自己的报表服务器。我有什么办法可以做到这一点?

具体来说,我将需要能够(至少)获取可用报告、查看报告和安排报告。我还没有通过 c# 接触过报告调度,但是参考我的本地报告服务,报告选择/查看非常简单。有没有办法为任何给定的报告服务动态加载 Web 服务——假设我知道 url 或服务器和实例名称?

        var rs = new ReportingService2005
            {
                Credentials = System.Net.CredentialCache.DefaultCredentials
            };

        // get catalog items from the report server database
        CatalogItem[] items = rs.ListChildren("/", true);

        // add each report to the combobox
        foreach (CatalogItem ci in items)
        {
            if (ci.Type == ItemTypeEnum.Report)
                comboBox1.Items.Add(ci.Path);
        }

这就是我目前正在做的提取可用报告的方法。但是,如上所述,它直接引用了我自己的报表服务器。 ReportingService2005(我将其命名为对我的 .asmx Web 服务的引用)是我希望能够动态加载的。

【问题讨论】:

    标签: c# sql sql-server reporting-services


    【解决方案1】:

    绝对有可能。 ReportingServices 具有您可以分配的.Url 属性。所以你可以这样做:

    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
    rs.Url = "http://<Server Name>/reportserver/ReportService2005.asmx";
    

    参考:“Setting the Url Property of the Web Service

    【讨论】:

    • 所以我需要专门引用一些网络服务,然后我可以更改 URL?
    • @claudekennilol 确实,在使用任何经典 WebService 时,这几乎是一种标准方法 - 在开发期间您可以加载本地服务(因此可以创建代理类),然后在运行时您可以更改网址。
    • 谢谢,我想这就是我的解决方案^_^。
    猜你喜欢
    • 2012-02-17
    • 2011-07-14
    • 1970-01-01
    • 1970-01-01
    • 2013-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多