1

我正在尝试将报告从文件系统上传到报告服务器,但由于某种原因,报告在我上传时没有出现

这是代码部分:

WebClient reptserv = new WebClient();
        File.WriteAllLines(@"C:\HereGoesNothing.rdl", lines);
        Uri address = new Uri("http://localhost/reportserver");
        reptserv.UploadFileAsync(address, @"C:\HereGoesNothing.rdl");           

该报告在报告生成器中运行得很好,所以我知道这不是问题,但在那之后我很难过。

4

1 回答 1

2

请看下面的问题答案,这是实现您想要做的更好的方法... 通过 .net 应用程序将报告文件上传到报告管理器?

基本上,您将服务引用添加到报表服务器,然后通过代理类上传,还请查看:http: //msdn.microsoft.com/en-us/library/aa237438%28SQL.80%29.aspx

public static void createReport()
{
  ReportingService rs = new ReportingService();
  rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

  Byte[] definition = null;
  Warning[] warnings = null;
  string name = "HereGoesNothing";

  try
  {
     FileStream stream = File.OpenRead(@"C:\HereGoesNothing.rdl");
     definition = new Byte[stream.Length];
     stream.Read(definition, 0, (int) stream.Length);
     stream.Close();
  }

  catch(IOException e)
  {
     Console.WriteLine(e.Message);
  }

  try
  {
     warnings = rs.CreateReport(name, "/", false, definition, null);

     if (warnings != null)
     {
        foreach (Warning warning in warnings)
        {
           Console.WriteLine(warning.Message);
        }
     }

     else
        Console.WriteLine("Report: {0} created successfully with no warnings", name);
  }

  catch (SoapException e)
  {
     Console.WriteLine(e.Detail.InnerXml.ToString());
  }

}

于 2011-03-16T16:48:09.250 回答