【问题标题】:SSRS wont publish report but it returns successful as if it didSSRS 不会发布报告,但它返回成功,就好像它发布了一样
【发布时间】:2011-10-13 19:34:32
【问题描述】:
public static void ListFolders()
{
    HomeFolderListing = new List<string>();

    ReportingServiceSoapClient rs = new ReportingServiceSoapClient();
    rs.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

    CatalogItem[] HomeFolders = null;
    string reportPath = "/";
    rs.ListChildren(reportPath, true, out HomeFolders);

    foreach (var homeF in HomeFolders)
    {

        if (homeF.Name.ToString().ToLower().Contains("base"))
        {
            if (homeF.Path.ToString().ToLower().Contains("/data sources/"))
            {
            }
            else
            {
                Console.WriteLine("Adding reporting folder: " + homeF.Name.ToString());
                HomeFolderListing.Add(homeF.Path.ToString());
            }
        }

    }

}

public static void PublishReport()
{
    foreach (string HomeFold in HomeFolderListing)
    {
        ReportingServiceSoapClient rs = new ReportingServiceSoapClient();
        rs.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

        BatchHeader bh = new BatchHeader();
        string batchID = null;
        rs.CreateBatch(out batchID);
        bh.BatchID = batchID;

        Byte[] definition = null;
        Warning[] warnings = null;

        try
        {
            FileStream stream = File.OpenRead(ReportInformation.Report2Deploy);
            definition = new Byte[stream.Length];
            stream.Read(definition, 0, (int)stream.Length);
            stream.Close();
        }
        catch (Exception ex)
        {

        }
        try
        {

            string filename = ReportInformation.ReportDeployNameOnly;
            Console.WriteLine("Deploying Report: " + filename + " to: " + HomeFold);
            rs.CreateReport(bh, filename, HomeFold, true, definition, null, out warnings);

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

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


        }
        catch (Exception ex)
        {

        }
    }
}

当我执行 rs.CreateReport() 时,它会返回,就好像它成功而没有警告一样,但是,当我查看服务器时它不存在。是的,我已经查看了所有文件夹。

【问题讨论】:

  • 我正在添加一个 web 服务作为常规服务,在 VS2010 中确保你进入高级。

标签: c# reporting-services reporting ssrs-2008


【解决方案1】:

你确定没有错误吗?有一个空的 catch 块。文档说要抓住SoapException。试试这个:

catch (SoapException e)
 {
      //Do something with the error, sample code write to console
      Console.WriteLine(e.Detail.InnerXml.ToString());
 }

取自:

http://msdn.microsoft.com/en-us/library/aa225813(v=sql.80).aspx

【讨论】:

  • SoapException 对我来说实际上并没有出现
  • 实际上如果解决了这个问题,但是是的,当我将其更改为 Soap Exception 时仍然没有抛出异常,我注意到(我使用的是 2005),msdn.microsoft.com/en-us/library/… 当我尝试警告时 = rs .CreateReport(name, "/Samples", false, definition, null);我无法将类型“ReportPublishingConsole.ReportingServices2005.ServerInfoHeader”隐式转换为“ReportPublishingConsole.ReportingServices2005.Warning[]”
  • 如果您使用的是 SQL Server 2008,您是否尝试过改用 CreateCatalogItem?这就是我们用来发布报告的内容。
猜你喜欢
  • 1970-01-01
  • 2015-04-26
  • 1970-01-01
  • 2012-09-17
  • 1970-01-01
  • 2021-02-27
  • 2019-04-19
  • 1970-01-01
  • 2023-02-25
相关资源
最近更新 更多