?
Solved

How to set (and why) the maximum message size quota

Posted on 2010-03-23
2
Medium Priority
?
615 Views
Last Modified: 2013-11-07
I am trying to use WPF and .NET 3.5 for the first time.

I have two questions:

1. In an existing .NET 2.0 WebService, I have these two lines right off the bat:

Private Share myService as ContactsWebService.Service1 = nothing
myService = New ContactsWebService.Service1

What is the .NET 3.5 version of these statements?

2. I tried

Dim MyService as ContactsWebService.Service1Soap = New ContactsWebService.Service1SoapClient

The compiler was happy, but when I called the first method:

myObject = MyService.mymethod

I get the "maximum size quota for incoming messages (65536) has been exceeded.....use the MaxReceivedMessageSize property on the the appropriate binding element"

Can someone straighten me out?
0
Comment
Question by:AIBMass
2 Comments
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 500 total points
ID: 28429567
1.
private static ContactsWebService.Service1 myService = null;
myService = New ContactsWebService.Service1();

2. open web.config and change the MaxReceivedMessageSize element
check this post for clarifications: http://geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx



0
 
LVL 21

Assisted Solution

by:masterpass
masterpass earned 500 total points
ID: 28430380
On the service tag, specify the binding configuration name:

    <service behaviorConfiguration="OrderServiceBehavior" name="WCFService.OrderService">
      <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IOrderService"
        contract="WCFService.IOrderService" />
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>

or try this:


System.ServiceModel.WSHttpBinding binding = new System.ServiceModel.WSHttpBinding(System.ServiceModel.SecurityMode.None);

binding.MaxReceivedMessageSize = 50000000;

System.ServiceModel.Description.MetadataExchangeClient mexClient = new System.ServiceModel.Description.MetadataExchangeClient(binding);

System.ServiceModel.Description.MetadataSet metadataSet = mexClient.GetMetadata(new System.ServiceModel.EndpointAddress("http://localhost:4000/mysite/aex"));

Open in new window

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Suggested Courses
Course of the Month3 days, 12 hours left to enroll

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question