Try the following:
In the installation directory of your Visual Studio where devenv.exe is located (e.g. C:Program FilesMicrosoft Visual Studio 9.0Common7IDE) add this section to the devenv.exe.cofig
<system.serviceModel>
<client>
<endpoint binding="customBinding" bindingConfiguration="largeServiceBinding" contract="IMetadataExchange" name="http" />
</client>
<bindings>
<customBinding>
<!-- NOTE: The binding name must be the same as specified in the config file of the wcf service -->
<binding name="largeServiceBinding" >
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport transferMode="Buffered" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
</system.serviceModel>
in the app.config of your WCF-service add the same binding:
<bindings>
<customBinding >
<!-- NOTE: The binding name must be the same as specified in the devenv.exe.config file located ..Common7IDE folder of the VS installation directory -->
<binding name="largeServiceBinding" >
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport transferMode="Buffered" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
Note that the name attribute of the binding tags from the two files must match (e.g. largeServiceBinding)
Finally add the following mex endpoint into your service tag:
<endpoint address="mex" binding="customBinding" contract="IMetadataExchange" bindingName="testBinding" bindingConfiguration="largeServiceBinding" name="http"/>
this may look like this:
<services>
<service behaviorConfiguration="MyServiceBehavior"
name="MyService.MyService">
<endpoint address="" binding="wsHttpBinding" contract="MyService.IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="customBinding" contract="IMetadataExchange" bindingName="testBinding" bindingConfiguration="largeServiceBinding" name="http"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/MyService/MyService/" />
</baseAddresses>
</host>
</service>
</services>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…