Производительность WCF tcp - PullRequest
1 голос
/ 06 марта 2012

У меня проблема с моей службой WCF.

Я сделал несколько тестов, и кажется, что мой базовый http быстрее моей конечной точки tcp !!Моя установка выглядит следующим образом: клиент вызывает службу wcf, служба wcf вызывает другую службу wcf, которая возвращает объект первой службе wcf, которая возвращает объект пользователю.

Вот моя конфигурация первой службы:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
    <bindings>
      <netTcpBinding>
        <binding name="tcpbinding">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="WcfService1.Service1Behavior"
        name="AutoleaseApp.LeasingCalculationService">
        <clear />
        <endpoint binding="basicHttpBinding" contract="AutoleaseApp.ILeasingCalculationService" name="http"
          listenUriMode="Explicit">
          <identity>
            <dns value="localhost" />
            <certificateReference storeName="My" storeLocation="LocalMachine"
              x509FindType="FindBySubjectDistinguishedName" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
          listenUriMode="Explicit">
          <identity>
            <dns value="localhost" />
            <certificateReference storeName="My" storeLocation="LocalMachine"
              x509FindType="FindBySubjectDistinguishedName" />
          </identity>
        </endpoint>
        <endpoint address="leasing.svc" binding="netTcpBinding" name="tcp"
          bindingConfiguration="tcpbinding" contract="AutoleaseApp.ILeasingCalculationService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://serapp/service" />
            <add baseAddress="net.tcp://serapp:808/service/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService1.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>

Вот конфигурация клиента:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="http" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
                <binding name="BasicHttpBinding_IClientCalculationService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
            <netTcpBinding>
                <binding name="tcp" closeTimeout="00:10:00" openTimeout="00:10:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
                    transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="None">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="http://serapp/service/Leasing.svc" binding="basicHttpBinding"
                bindingConfiguration="http" contract="ServiceReference1.ILeasingCalculationService"
                name="http" />
            <endpoint address="net.tcp://serapp/service/Leasing.svc/leasing.svc"
                binding="netTcpBinding" bindingConfiguration="tcp" contract="ServiceReference1.ILeasingCalculationService"
                name="tcp">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="http://serweb/service/Service1.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IClientCalculationService"
                contract="ServiceReference2.IClientCalculationService" name="BasicHttpBinding_IClientCalculationService" />
        </client>
    </system.serviceModel>
</configuration>

Сервис довольно прост, он просто вызывает другой сервис и возвращает объект, ничего страшного.

Тестовое приложение просто вызывает сервис: с помощью (ClientCalculationServiceClient c = new

ServiceReference2.ClientCalculationServiceClient())
                    {
res = c.CalculateLeasingClient(new InputObj() { CarID = "".ToString(), SessionID = "".ToString() });
}

Возможно, проблема в конфигурации сервера IIS?

Кто-нибудь?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...