1

我有一个测试系统,其中包含一个与 wcf 服务通信的 winforms 客户端应用程序,该服务允许我根据用户选择的标准打印报告。在 wcf 方面,我们有一些 rdlc 文件,我们试图在其中显示一些图像。我们生成图像并将它们保存到磁盘,并将图像的文件路径作为数据源中数据集的一部分传递。以下代码生成图像

var image = Code128Rendering.MakeBarcodeImage(barcode, 2, true);
var imageFilename = HttpContext.Current.Server.MapPath(string.Format("{0}.bmp", imageId));                
image.Save(imageFilename);

要创建我的数据集,我有以下内容

var rmDS = new List<object>()
{
    new TestObj()
            {
                Barcode = GenerateBarcode(DateTime.Now.Ticks.ToString()),
            },                
};

return rmSpecialDeliveryService;

我将此添加到报告数据源中。当我尝试呈现报告时,我收到以下警告消息

Warning: Images with external URL references will not display if the report is    
published to a report server without an UnattendedExecutionAccount or the target 
image(s) are not enabled for anonymous access. (rsWarningFetchingExternalImages)

我用于渲染的代码如下:

var deviceInfo =
          @"<DeviceInfo>
            <OutputFormat>EMF</OutputFormat>
            <PageWidth>8.5in</PageWidth>
            <PageHeight>11in</PageHeight>
            <MarginTop>0.25in</MarginTop>
            <MarginLeft>0.25in</MarginLeft>
            <MarginRight>0.25in</MarginRight>
            <MarginBottom>0.25in</MarginBottom>
        </DeviceInfo>";            

Warning[] warnings;
m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream, out warnings);
foreach (var stream in m_streams){ stream.Position = 0; }

任何帮助将不胜感激!!!

4

1 回答 1

0

5年后...

我今天遇到了同样的问题,必须在运行 SSRS 的服务器上的 Reporting Services 配置管理器中设置一个执行帐户。表面上这是需要的,因为 SSRS 渲染器运行的任何默认帐户都无权访问我正在使用的图像。添加有权访问图像的域帐户并重新启动 SSRS 后,我的报告现在可以工作了。

于 2017-04-12T20:47:57.447 回答