简体   繁体   中英

WCF minimal client app.config settings

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.

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>

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM