Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 如何实现此nettcpbinding配置的CustomBinding配置_Wcf_Nettcpbinding - Fatal编程技术网

Wcf 如何实现此nettcpbinding配置的CustomBinding配置

Wcf 如何实现此nettcpbinding配置的CustomBinding配置,wcf,nettcpbinding,Wcf,Nettcpbinding,我有一个nettcpbinding wcf服务。它在一秒钟内调用了100000多次,因此性能方面存在更多问题。我必须优化这个 我的第一个问题是:新接受的连接没有在配置的ChannelInitializationTimeout 00:00:05内从发送方接收初始化数据。因此,连接将被中止。如果你在一个高度拥挤的网络上,或者你的发送机器负载很重,考虑增加这个值或者负载平衡你的服务器。 我应该使用CustomBinding设置ChannelInitializationTimeout。我读了一些示例,但

我有一个nettcpbinding wcf服务。它在一秒钟内调用了100000多次,因此性能方面存在更多问题。我必须优化这个

我的第一个问题是:新接受的连接没有在配置的ChannelInitializationTimeout 00:00:05内从发送方接收初始化数据。因此,连接将被中止。如果你在一个高度拥挤的网络上,或者你的发送机器负载很重,考虑增加这个值或者负载平衡你的服务器。 我应该使用CustomBinding设置ChannelInitializationTimeout。我读了一些示例,但没有实现配置

如何实现以下配置到custombinding配置

<?xml version="1.0"?>
<configuration>
   <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Warning" propagateActivity="false">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="E:\Services\Ozy3\logs\EventParserService.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>

  <system.web>
     <compilation debug="true" />
  </system.web>

    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>

    <system.serviceModel>
    <services>
      <service name="Ozy3.Services.EventParserService" behaviorConfiguration="Ozy3.Services.EventParserServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:3274/EventParserService" />
          </baseAddresses>
        </host>
        <endpoint address="net.tcp://localhost:3273/EventParserService" binding="netTcpBinding" bindingConfiguration="tcp_Unsecured" contract="Ozy3.Domain.Contracts.Service.IEventParserService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
   <bindings>
      <netTcpBinding>
        <binding name="tcp_Unsecured" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2147483647" maxReceivedMessageSize="2147483647" portSharingEnabled="false" transactionFlow="false" listenBacklog="2147483647" 
        closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None"></security>
        </binding>
      </netTcpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="Ozy3.Services.EventParserServiceBehavior">
             <dataContractSerializer maxItemsInObjectGraph="2147483647" />
              <serviceThrottling maxConcurrentCalls="32" maxConcurrentSessions="200" maxConcurrentInstances="232" />  
              <serviceMetadata httpGetEnabled="True" />
              <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

我使用.Net的customTcpBinding和Protocol Buffer解决了这个问题,但我知道使用nettcpbinding快速高效的10GBit以太网和Cat6电缆需要高容量网络

<system.serviceModel>
        <services>
            <service behaviorConfiguration="EventDecoderService.ServiceBehavior"
                name="WcfService1.EventDecoderService">
                <host>
                    <baseAddresses>
                        <add baseAddress="http://192.168.1.67:9001" />
                    </baseAddresses>
                </host>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <endpoint address="net.tcp://192.168.1.67:9000" behaviorConfiguration="EventDecoderService.EndpointBehavior"
                    binding="customBinding" bindingConfiguration="customBind"
                    name="EventDecoderService.Endpoint" contract="WcfService1.IEventDecoderService" />
            </service>
        </services>
        <bindings>
            <customBinding>
                <binding name="customBind"
         closeTimeout="00:10:00"
         openTimeout="00:10:00"
         receiveTimeout="00:10:00"
         sendTimeout="00:10:00">
                    <binaryMessageEncoding>
                        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                    </binaryMessageEncoding>
                    <tcpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" hostNameComparisonMode="StrongWildcard"
                                                maxBufferSize="2147483647" maxPendingConnections="100"  channelInitializationTimeout="00:10:00"
                                                transferMode="Buffered" listenBacklog="1000" portSharingEnabled="false" teredoEnabled="false" >
                        <!--<connectionPoolSettings maxOutboundConnectionsPerEndpoint ="1000" />-->
                    </tcpTransport>

                </binding>
            </customBinding>
            <netTcpBinding>
                <binding name="tcp_Unsecured" maxBufferPoolSize="2147483647"
             closeTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" openTimeout="10:00:00"
                    maxBufferSize="2147483647" maxConnections="10000" maxReceivedMessageSize="2147483647">
                    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                    <security mode="None">
                        <transport clientCredentialType="None" protectionLevel="None" />
                        <message clientCredentialType="None" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <behaviors>
            <endpointBehaviors>
                <behavior name="EventDecoderService.EndpointBehavior">
                    <ProtoBufSerialization />
                    <dataContractSerializer maxItemsInObjectGraph="2147483647" />
                </behavior>
            </endpointBehaviors>
            <serviceBehaviors>
                <behavior name="EventDecoderService.ServiceBehavior">
                    <serviceMetadata httpGetEnabled="True" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <dataContractSerializer maxItemsInObjectGraph="2147483647" />
                    <serviceTimeouts transactionTimeout="00:10:10"/>
                    <serviceThrottling
                        maxConcurrentCalls="96"
                        maxConcurrentSessions="600"
                        maxConcurrentInstances="696"
                     />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <extensions>
            <behaviorExtensions>
                <add name="ProtoBufSerialization"
                         type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net, Version=2.0.0.480, Culture=neutral, PublicKeyToken=257b51d87d2e4d67"/>
            </behaviorExtensions>
        </extensions>
    </system.serviceModel>

你好您是否找到了解决问题的方法,因为如果您能与我分享,我可能会感兴趣。谢谢