This is a migrated thread and some comments may be shown as answers.

Silverlight Report PictureBox Byte[]

4 Answers 128 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Fletcher Aluminium
Top achievements
Rank 1
Fletcher Aluminium asked on 15 Dec 2010, 01:58 AM
Hey,

I am currently in a spot of trouble.  I am attempting to add a picture box to a Telerik Report and bind it's "Value" property to one of the columns I am returning from data.  The data type of the column that is returned is System.Byte[]

I am doing this by setting the value property to be "=Fields.Drawing".

When I click on the Preview OR the Html Preview tab at the top, this image displays with no problem what so ever.  The report is as I expected it to be.

However, once I attempt to view this particular report in a Silverlight application using WCF Service and the Silverlight Telerik Reporting Report Viewer, it does not display the image.  It does not give an error that I can see.  It also does not show a red box or anything to show that it failed.  It just simply does not show a picture. 

Considering that all of the text from that particular row which I have also added to the report (i.e. Description, Order no etc) show up perfectly, I can only assume that something is not happening to display the picture.  I have also put a break point on the event:

private void PictureBox1_ItemDataBound(object sender, EventArgs e)
{
 
}

Once the report hit this (while running from Silverlight) it does has the proper data in the Data part of the picture box.  So considering all of these things, I can not come up with a reason after hours of searching this forum as to why my particular image is not showing up.

Any assistance, projects or guidance in regards to this would be fantastic.  If you believe that it may be something about how I have set up my WCF Service, let me know and I will start posting my code.

Regards,



Shaun Sharples
Fletcher Aluminium

4 Answers, 1 is accepted

Sort by
0
Fletcher Aluminium
Top achievements
Rank 1
answered on 16 Dec 2010, 02:55 AM
Hey,

Just hoping to get some responses, by either someone else experiencing this problem and had a fix, or a Telerik Employee.

Cheers,


Shaun Sharples
0
Steve
Telerik team
answered on 16 Dec 2010, 01:27 PM
Hello Shaun,

Most likely the problem is that you're missing the resources endpoint in your web.config file. If you are familiar with WCF services and their configuration, images are streamed through the resources endpoint. For more information on setting up the Telerik Reporting service, please refer to the Hosting WCF Service in IIS help article.

Regards,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Fletcher Aluminium
Top achievements
Rank 1
answered on 19 Dec 2010, 09:16 PM
Hey Steve,

I did attempt to follow the help article, however, as soon as I add in either the mex endpoint or the resources end point, I get:

"HTTP Error 401. The requested resource requires user authentication."

That is because I am using a basicHttpBinding and using Windows credentials:

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
        <dataContractSerializer maxItemsInObjectGraph="6553600"/>
      </behavior>
      <behavior name="ReportServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="WebBehavior" >
        <webHttp />
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <bindings>
    <basicHttpBinding>
      <binding name="Binding1">
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Windows" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  <services>
    <service name="Telerik.Reporting.Service.ReportService"
             behaviorConfiguration="ReportServiceBehavior">
      <endpoint address=""
                binding="basicHttpBinding"
                bindingConfiguration="Binding1"
                contract="Telerik.Reporting.Service.IReportService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <endpoint address="resources"
                binding="webHttpBinding"
                behaviorConfiguration="WebBehavior"
                contract="Telerik.Reporting.Service.IResourceService"/>
    </service>
  </services>
</system.serviceModel>

Is there something wrong with what I have done here?

Regards,


Shaun Sharples
0
Fletcher Aluminium
Top achievements
Rank 1
answered on 20 Dec 2010, 10:28 PM
Hey all,

I seemed to have a brain fart.  The reason that it was not working is because I had not given the resource end point a webHttpBinding of Transport type windows:

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
        <dataContractSerializer maxItemsInObjectGraph="6553600" />
      </behavior>
      <behavior name="ReportServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="WebBehavior">
        <webHttp />
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <bindings>
    <basicHttpBinding>
      <binding name="Binding1">
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Windows" />
        </security>
      </binding>
    </basicHttpBinding>

    <webHttpBinding>
      <binding name="webBinding">
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Windows" />
        </security>
      </binding>
    </webHttpBinding>

  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
    multipleSiteBindingsEnabled="true" />
  <services>
    <service name="Telerik.Reporting.Service.ReportService" behaviorConfiguration="ReportServiceBehavior">
      <endpoint address="" binding="basicHttpBinding" bindingConfiguration="Binding1" contract="Telerik.Reporting.Service.IReportService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>

      <endpoint address="resources"
                binding="webHttpBinding"
                bindingConfiguration="webBinding"
                behaviorConfiguration="WebBehavior"
                contract="Telerik.Reporting.Service.IResourceService" />

    </service>
  </services>
</system.serviceModel>

Looking at the bold bits of the above code, notice that I specified the bindingConfiguration of the resources end point.  This is what was missing.

Note: Putting in the Mex endpoint still makes this service fail.

Thanks for reading this, and hopefully it helps someone out later,


Cheers,


Shaun Sharples
Fletcher Aluminium
Tags
General Discussions
Asked by
Fletcher Aluminium
Top achievements
Rank 1
Answers by
Fletcher Aluminium
Top achievements
Rank 1
Steve
Telerik team
Share this question
or