One of the more common questions I get is along these lines:
I want to configure svcutil to use a particular binding. How do I do that?
Usually, this happens for one of two reasons:
1) You’ve exposed your metadata with a secure binding, and need a way to generate proxy from it.
2) The size of your metadata is too large for svcutil’s defaults.
In both these cases, you usually get a non-descript error message from svcutil:
Error: Cannot obtain Metadata from http://localhost/
If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
Metadata contains a reference that cannot be resolved: 'http://localhost/mex.
There is an error in XML document (1, 120595).
The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 120595.
The way to fix these issues is to locate your copy of svcutil.exe (usually under C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin), create a file called svcutil.exe.config and add configuration just like you would configure a client endpoint.
For example, to use an http binding that has the maximum value for each quota, copy the following XML into your svcutil.exe.config
<?xml version="1.0" encoding="utf-8"?>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" />
<endpoint binding="customBinding" bindingConfiguration="MaxQuotasBinding" contract="IMetadataExchange" name="http" />
Of course, the same method can be used to change the type of binding you want to use (named pipes, tcp, etc…) and to configure your binding with security.
PingBack from http://asp-net-hosting.simplynetdev.com/configuring-the-client-endpoint-for-svcutil/
Thank you for submitting this cool story - Trackback from DotNetShoutout