Wednesday, March 7, 2012

Problem with displaying image on the report

I have a webservice which creates an image returns that image in the form of Byte array. I want to consume this webservice and display that image on my report. When I see my report in the Preview tab of the report designer, it displays that image but when I deploy my report on the report server, image doesn't show up. I have copied app_code.dll (dll for the webservice) to the following locations:

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin

Here is the code for the webservice:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Drawing
Imports System.Diagnostics
Imports System.IO

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Public Class Service
Inherits System.Web.Services.WebService

<WebMethod()> _

Public Function HelloWorld() As Byte()

Dim marker As New Bitmap("C:\Inetpub\wwwroot\help.gif")
Dim imageStream As New System.IO.MemoryStream
marker.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg)
Trace.Write("Before Write")
Return imageStream.ToArray()

End Function

End Class

I have referenced this dll saved in public assemblies folder from my report project and wrote a function to call the above mentioned webservice function HelloWorld() and called the function from value property of an image control on the report.

Does anybody has any idea what am I missing?

Thanks

Its probably an authentication problem. Try configuring an Unattended Execution Account for SRS to an account which has permission to access the web service on the remote machine. Also check the IIS logs on the machine serving the image for failed login attempts.

No comments:

Post a Comment