Skip to main content

Microsoft Silverlight

Answered Question Silverlight 2.0 Display Database Images Service Max Size ExeededRSS Feed

(0)

kemaltolga
kemaltolga

Member

Member

140 points

113 Posts

Silverlight 2.0 Display Database Images Service Max Size Exeeded

hi:

I am simply trying to display database images in silverlight. I am using a WCF service, like recommended but they the following error message.

An exception of type 'System.ServiceModel.CommunicationException' occurred in System.ServiceModel.dll but was not handled in user code

Additional information: [MaxReceivedMessageSizeExceeded]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=System.ServiceModel.dll&Key=MaxReceivedMessageSizeExceeded

Below is part of the web.config file and .ClientConfig file

<system.serviceModel>

<bindings>

<basicHttpBinding>

<binding name="NewBinding0" closeTimeout="00:30:00" openTimeout="00:30:00" sendTimeout="00:30:00" maxReceivedMessageSize="2147483647">

<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"></readerQuotas>

</binding>

</basicHttpBinding>

</bindings>

<behaviors>

<serviceBehaviors>

<behavior name="GraphicsContestServiceBehavior">

<serviceMetadata httpGetEnabled="true" />

<serviceDebug includeExceptionDetailInFaults="false" />

</behavior>

</serviceBehaviors></behaviors>

 

<services>

<service behaviorConfiguration="GraphicsContestServiceBehavior" name="GraphicsContestService">

<endpoint address="" binding="basicHttpBinding" contract="IGraphicsContestService" bindingConfiguration="NewBinding0">

<identity>

<dns value="localhost" />

</identity>

</endpoint>

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

</service>

</services>

 

</system.serviceModel>

 .clientconfig file=================================================

<configuration>

<system.serviceModel>

<bindings>

<basicHttpBinding>

<binding name="BasicHttpBinding_IGraphicsContestService"

maxBufferSize="2147483647"

maxReceivedMessageSize="2147483647">

<security mode="None" />

</binding>

</basicHttpBinding>

</bindings>

<client>

<endpoint address="http://localhost:4386/GraphicsContestv2_Web/GraphicsContestService.svc"

binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGraphicsContestService"

contract="GraphicsContestv2.GraphicsContestService.IGraphicsContestService"

name="BasicHttpBinding_IGraphicsContestService" />

</client>

</system.serviceModel>

</configuration>

 

Application Developer
tkoseoglu@live.com

swildermuth
swildermuth

Star

Star

8320 points

1,546 Posts

Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

Bad news...good news....

Bad news...the clientconfig isn't being read in the Beta...its being created and ignored right now.  This is expected to change in Beta 2 or RTM.

Good news, when you create your Binding, just add the options with the new sizes and it works (my http://www.silverlightdata.com example does this and it works fine).

(If this has answered your question, "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 3 Workshop
Miami, FL: Oct 12-14th
Portlant, OR: Dec 2-4th
Atlanta, GA: Dec 7-9th
http://silverlight-tour.com

kgvinayak
kgvinayak

Member

Member

12 points

1 Posts

Answered Question

Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

I was getting into the same issue.

Added below is the code snippet for the same

            BasicHttpBinding binding = new BasicHttpBinding();
            binding.MaxReceivedMessageSize = 2147483647; // int's max size
            binding.MaxBufferSize = 2147483647; // int's max size
 

This binding has to go into the serviceClient's constructor along with EndPointAddress.

Thanks,
Vinayak

swildermuth
swildermuth

Star

Star

8320 points

1,546 Posts

Re: Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

Exactly...

(If this has answered your question, "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 3 Workshop
Miami, FL: Oct 12-14th
Portlant, OR: Dec 2-4th
Atlanta, GA: Dec 7-9th
http://silverlight-tour.com

ravi486
ravi486

Member

Member

46 points

36 Posts

Re: Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

Hi

swildermuth 

I am doing that exactly but i am unable to cross the limit how is exactly done could u share any kind of code snippet it will be helpful for us

have a lokk at what i am doing and correct me if i am doing any thing wrong

HttpWebRequest request = asyncResult.AsyncState as HttpWebRequest;

HttpWebResponse response = request.EndGetResponse(asyncResult) as HttpWebResponse;

BasicHttpBinding binding = new BasicHttpBinding();

binding.MaxReceivedMessageSize = 2147483647; // int's max size

binding.MaxBufferSize = 2147483647; // int's max size

EndpointAddress ene = new EndpointAddress("http://localhost:4237/Upload_Web/Service.svc");

ServiceReference1.ServiceClient proxy = new Upload.ServiceReference1.ServiceClient(binding, ene);

proxy.WorksCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(proxy_WorksCompleted);

Stream f = response.GetResponseStream();

byte[] fileBytes = new byte[8000];

int byteCount = f.Read(fileBytes, 0, 8000);

string fileContents = Convert.ToBase64String(fileBytes);string[] ar = new string[] { fileContents, fileContents};

proxy.WorksAsync(ar);

}

void proxy_WorksCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)

{

}

It is throwing me a error

An exception of type System.ServiceModel.ProtocolException occured in System.serviceModel.dll

Additional information [ UnexpectedHTTPCode]

Arguments :Not found

 

 

Thx in advance

Ravi

senthilkumarc
senthilk...

Member

Member

2 points

1 Posts

Re: Re: Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

The problem is your WCF  Webservice is not hosted in IIS and it is hosted in a port which for a client web application it is a separate domain as of now(its my understatnding). The solution is
host your WCF Webservice in IIS as well as your client Web Application. Also copy the below CrossDomain.xml and clientaccesspolicy.xml from the link http://silverlight.net/forums/t/12495.aspx in Root Web Directory(c:\Inetpub\WWWRoot).

It doesnt work without copying the xml files.

cschep
cschep

Member

Member

10 points

12 Posts

Re: Re: Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

You probably got this figured out already, but I just wanted to chime in that I was dealing with all of this and getting similar errors.

First the max size exceeded was a pain, but that was a pretty quick fix by manually creating the binding and endpoint. Thanks for that.

But, when I was doing that I created my endpoint incorrectly. I am developing in VS2008 and using the built-in webserver to test all of this, so all the talk about cross-domain calls failing didn't seem right.

It turns out I just declared my endpoint incorrectly.

 

I was doing this:

EndpointAddress endPoint = new EndpointAddress("http://localhost:53114/SlideShow_Web/Service1.svc"); 

When this was correct:

EndpointAddress endPoint = new EndpointAddress("http://localhost:53114/Service1.svc");

 
So, just a heads up. Give your project a static PORT in the properties page, and make sure you're pointing to your service correctly!

 
Thanks for the help getting Silverlight to consume these WCF services. LINQ is cool stuff for sure.

 

diekus
diekus

Member

Member

173 points

80 Posts

Re: Re: Re: Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

Hi, always in the same subject.... how much is too much?

This maxInt.... how much can it take?

diekus
diekus

Member

Member

173 points

80 Posts

Re: Re: Re: Re: Re: Silverlight 2.0 Display Database Images Service Max Size Exeeded

ok, now I'm a believer.... it can take A LOT...

 

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities