Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
298 views
in Technique[技术] by (71.8m points)

c# - ReportingService2010 could not be found

I have:

private readonly ReportingService2010 _rs = new ReportingService2010();

Error:

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

I setup a reference to the SSRS service. The reference does not give me access to ReportingService2010 as I expect. The closest thing is:

MySsrsServiceNamespace.ReportingService2010SoapClient

How am I supposed to use the ReportingService2010 class? MSDN lists this class vaguely.

Please note I tried using ReportingService2010SoapClient. This class does not match the documentation for ReportingService2010. For example, ListChildren() only accepts 4 parameters and the Url property does not exist.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Just ran into the exact same issue. ReportingService2010SoapClient class was available, but the ReportingService2010 class was not. Was driving me nuts. I had added it as a "Service References", but you have to add it as a "Web References", like so:

  1. Delete your old Service Reference

  2. Right click on References. The "Add Service Reference" dialog comes up.

  3. Do not enter the WSDL URL now, instead: Click on the "Advanced" button at the bottom left.

  4. The "Service Reference Settings" dialog comes up.

  5. At the bottom left, click the "Add Web Reference" button.

  6. Now enter the URL for the WSDL. (for me that was servername/ReportServer/ReportService2010.asmx)

  7. Click the small arrow on the right, it will take its sweet time to load.

  8. Name the web reference, I used "ReportingService2010WebReference", but ReportingService2010" probably works just as well.

  9. Click "Add Reference"

  10. In your code, update your using statements to "using .ReportingService2010WebReference (or whatever name you picked)

Code:

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

Worked on the first try. Web.config file wasn't touched.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...