I've got a large class with many functions exposed as a WCF service, which also has a mex endpiont. Now, when I'm trying to add a reference to that service in Visual Studio 2010, I'm getting following error:
Is there anything I can do, besides cutting back on the method count, to make this error disappear?
Here's the code I'm using for the mex endpoint:
// Check to see if the service host already has a ServiceMetadataBehavior
ServiceMetadataBehavior smb = svh.Description.Behaviors.Find<ServiceMetadataBehavior>();
// If not, add one
if (smb == null)
smb = new ServiceMetadataBehavior();
//smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
svh.Description.Behaviors.Add(smb);
// Add MEX endpoint
svh.AddServiceEndpoint(
ServiceMetadataBehavior.MexContractName,
MetadataExchangeBindings.CreateMexTcpBinding(),
location+"/mex"
);
You can override this with the maxNameTableCharCount attribute on the readerQuota node in your config file.
Here is the <readerQuote> documenation: http://msdn.microsoft.com/en-us/library/ms731325.aspx
This is an example of the auto-generated client side configuration. The default value is 16384.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="YOUR_NAME" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="268438456" maxBufferPoolSize="524288" maxReceivedMessageSize="268438456"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="YOUR_ADDRESS" binding="basicHttpBinding"
bindingConfiguration="YOUR_ENDPOINT" contract="YOUR_CONTRACT"
name="YOUR_NAME" />
</client>
</system.serviceModel>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With