I am using svcutil to generate a proxy file for use against a service we consume. Currently, I have a batch file that we can run at anytime to regenerate the proxy file if the service changes. However, I always have to adjust a few values on the bindings after the proxy file generation. Some examples of the changes I need to make are to maxbuffersize, maxreceivedmessagesize and sendtimeout.
Are there any switches to adjust these values as part of the generation process or does it need to be done via post processing of the generated client?
Thanks.
Edit:
“C:\Program Files\Microsoft SDKs\Windows\v7.0a\bin\SvcUtil.exe”
/tcv:Version35 /config:Proxy.config /t:code
https://myserviceprovider.com/Webservices/FirstService.svc?wsdl
/out:FirstServiceClient.cs
/namespace:”http://FirstService/services/”,”MyServices.FirstService”“C:\Program Files\Microsoft SDKs\Windows\v7.0a\bin\SvcUtil.exe”
/tcv:Version35 /config:Proxy.config /t:code
https://myserviceprovider.com/Webservices/SecondService.svc?wsdl
/out:SecondServiceClient.cs /mergeConfig
/namespace:”http://SecondService/services/”,”MyServices.SecondService”
…
So in the above example, the first statement creates the Proxy.config file, and the second command uses /merge to merge what is generated by the second statment with the first. In reality there are a few other commands after these and I end up with a Proxy.config file that allows me to connect with the webservice. The problem is, the generated Proxy.Config has some example bindings like the following;
<binding name="FirstServiceBasicHttpEndpoint" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
In the XML snippet above, I’ve already adjusted the maxBufferSize and maxReceivedMessageSize but I’d be keen to know if it were possible to do this as part of a svcutil switch.
You need to tweak the svcutil.exe.config as demonstrated in this post: http://enterpriseframework.com/post/2009/04/09/Using-a-External-Configuration-file-for-SvcUtilexe-to-generate-a-WCF-Service-Proxy.aspx