9

app.config で合理化された WCF 構成のために必要な最小限のクライアント設定は何ですか?

デフォルトのものはこれです:

    <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>

何を除外できますか? また、そのどれだけが必要ですか?


編集:壊れるまでパーツを剥ぎ取り始めるべきですか?私は、人々が幸運に恵まれる、最適化された優れた wsHttpBindings を見つけることを望んでいました。

4

3 に答える 3

8

Jerograv の言うとおりです。これらはすべて省略可能なデフォルト値であるためです。これをテストするために、私は単純なサービスを作成し、ほとんどのアドレス、バインディング、およびコントラクトである必要最小限の構成を作成しました。

<?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>
于 2009-01-16T14:36:21.200 に答える
7

WCF の ABC を思い出してください。住所、拘束力、契約。それだけです!

クライアントには、WCF サービスと通信するためのエンドポイントのみが必要です。各エンドポイントは、それぞれの ABC を記述するだけで済みます。他のものは後で追加できます。

これが、私が Visual Studio にサービス参照を追加することをあまり好まない理由の 1 つです。

于 2009-01-17T18:13:52.883 に答える
4

これらはすべてオプションであることがわかると思います。その特定のバインディングにあるものはすべて、とにかくデフォルトです。

実際、この場合、エンドポイントでバインディングを指定することはオプションだと思います。

于 2009-01-16T00:35:41.197 に答える