c# - 找不到 ReportingService2010

标签 c# .net reporting-services

我有:

private readonly ReportingService2010 _rs = new ReportingService2010();

错误:

The type or namespace name 'ReportingService2010' could not be found (are you missing a using directive or an assembly reference?)

setup对 SSRS 服务的引用。该引用没有像我预期的那样让我访问 ReportingService2010。最接近的是:

MySsrsServiceNamespace.ReportingService2010SoapClient

我应该如何使用 ReportingService2010 类? MSDN含糊地列出这个类。

请注意,我尝试使用 ReportingService2010SoapClient。此类与 ReportingService2010 的文档不匹配。例如ListChildren()只接受4个参数,Url属性不存在。

最佳答案

刚刚遇到了完全相同的问题。 ReportingService2010SoapClient 类可用,但 ReportingService2010 类不可用。快把我逼疯了。我已将其添加为“服务引用”,但您必须将其添加为“Web 引用”,如下所示:

  1. 删除旧的服务引用

  2. 右键单击引用文献。 “添加服务引用”对话框出现。

  3. 现在不要输入 WSDL URL,而是:单击左下角的“高级”按钮。

  4. 出现“服务引用设置”对话框。

  5. 在左下角,单击“添加 Web 引用”按钮。

  6. 现在输入 WSDL 的 URL。 (对我来说是服务器名/ReportServer/ReportService2010.asmx)

  7. 点击右边的小箭头,加载会很慢。

  8. 为 Web 引用命名,我使用“ReportingService2010WebReference”,但 ReportingService2010"可能同样有效。

  9. 点击“添加引用”

  10. 在您的代码中,将您的 using 语句更新为“using .ReportingService2010WebReference(或您选择的任何名称)”

代码:

private MySol.ReportService2010WebReference.ReportingService2010 rsClient;

rsClient = new ReportingService2010();
rsClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

CatalogItem[] items = null;

items = rsClient.ListChildren("/", false);

foreach (var item in items)
{
    tr.ErrorMessage += (item.Path + " " + item.CreatedBy);
}

进行了第一次尝试。未触及 Web.config 文件。

关于c# - 找不到 ReportingService2010,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18964295/

相关文章:

mysql - 我可以使用 ODBC 参数两次吗?

python - Django 或 Python 中的数据库报告服务

c# - 将注册表字符串值读入列表

c# - 我怎样才能找出是什么在制造垃圾?

c# - 有没有办法在应用程序域中传递和使用引用类型/值类型的地址? (C#)

java - 事务处理多层应用程序

c# - 在没有 dll 的情况下在 2 个项目之间共享代码

c# - Unity AudioSource 无法播放剪辑

c# - 如何在数据表中添加图像?

sql - fetchxml 脚本中的 case 语句