Tuesday, December 15, 2009

Problem Importing Bulk Typed Objects from WCF or Problem getting huge list using WCF

If you are experiencing problem referencing a WCF Web Service from Silverlight which transmits bulk Data in terms of List then you have to tweak ur configuration a little in order to make our application run.

Suppose you have a silverlight application having a DropDownlist which would display 1/2 million names of a Type,say Person.

Your Wcf application is having a service contact that you pass 1/2 a million Types to the SilverLight application, eg: List GetAllPersons();

List personList=new List();
So you have a list containing 1/2 a million objects of Type and each having the details of TYpe.

The web.Config of the WCF Service Application should have BindingConfiguration and that configuration should possess these properties transferMode="Streamed",maxBufferSize="65536",maxReceivedMessageSize="204003200"'.
Here the Streamed transfer mode would help us to transit Bulk Typed Objects from WCF Service.

<'system.serviceModel'>
<'behaviors'>
<'serviceBehaviors'>
<'behavior name="ServiceBehavior1"'>
<'serviceMetadata httpGetEnabled="true"' />
<'serviceDebug includeExceptionDetailInFaults="false"' />
<'/behavior'>
<'/serviceBehaviors'>
<'/behaviors'>
<'services'>
<'service behaviorConfiguration="ServiceBehavior1" name="PersonInfo"'>
<'endpoint address="" binding="basicHttpBinding" bindingConfiguration="StreamBinding"
contract="IPersonInfo"'>
<'identity'>
<'dns value="localhost"' />
<'/identity'>
<'/endpoint'>
<'endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"' />
<'/service'>
<'/services'>

<'bindings'>
<'basicHttpBinding'>
<'binding name="StreamBinding"
transferMode="Streamed"
maxBufferSize="65536"
maxReceivedMessageSize="204003200"' />



No comments: