views:

844

answers:

3

What are the minimal 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.

+2  A: 

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.

Jero
+5  A: 

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>
Yossi Dahan
perfect, thank you!
Tom Anderson
+5  A: 

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.

Terry Donaghe