9

What are the minimal client settings i need to do for a streamlined WCF config in the app.config?

The default one is this:

    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                    enabled="false" />
                <security mode="Message">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"
                        algorithmSuite="Default" establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>

What can I exclude, and how much of that do i need?


Edit: Should i just start ripping out parts till it breaks? I was hoping to find some good optimized wsHttpBindings that people have good luck with.

1
  • It's not clear from the question if we should take the perspective of being a server or a client. The minimal configuration could differ. In any way I guess that no binding configuration should be needed whatsoever. Both a WCF client and a server could work very well without any binding configuration. The minimal configuration would be either the <client> or <services> element depending on if the question is aimed at a client or a server.
    – Jim Aho
    Mar 4, 2016 at 14:22

3 Answers 3

8

Jerograv is right, given that these are all defaults you can omit all of them. To test this I've created a simple service and created the minimal config required which is pretty much the address, the binding and the contract-

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <client>
            <endpoint address="http://sabra2/TestService/Service1.svc" binding="wsHttpBinding"
                contract="IService1"/>
        </client>
    </system.serviceModel>
</configuration>
2
  • This is answered from the perspective of a client. So it's true that the minimal configuration is a <endpoint> element, but the surrounding will be either <client> or <service> depending on if you're a client or server.
    – Jim Aho
    Mar 4, 2016 at 14:24
  • And also, if this would've been the server, you would need no address value, it could be just empty (if hosted from IIS as the address from your IIS binding would be taken).
    – Jim Aho
    Mar 4, 2016 at 14:26
7

Just remember the ABC's of WCF. Address, Binding, Contract. That's all you need!

Your client only has to have an endpoint to talk to a WCF Service. Each endpoint only needs to describe each of the ABC's and you're done. The other stuff can be tacked on later.

That's one reason I'm not a big fan of adding Service References in Visual Studio.

4

I think you'll find that all of that is optional. All of those things in that particular binding are the defaults anyway.

In fact I think specifying the binding at all in the endpoint would be optional in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.