WCF tcpTrace.exe配置

Web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="metadataBehavior">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    
    <services>
      <service behaviorConfiguration="metadataBehavior" name="Services.CalculatorService">
        <endpoint binding="wsHttpBinding" contract="Contracts.ICalculator" />
      </service>
    </services>
    
  </system.serviceModel>
    <system.web>
        <authentication mode="Forms" />
    </system.web>
</configuration>

Clent App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
      <behaviors>
        <endpointBehaviors>
          <behavior name="calculatorEndpointBehavior">
              <clientVia viaUri="http://localhost:100/CalculatorService.svc" />
          </behavior>
        </endpointBehaviors>
      </behaviors>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_CalculatorService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    useDefaultWebProxy="true" allowCookies="false">
                    <security>
                        <transport realm="" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:96/CalculatorService.svc" behaviorConfiguration="calculatorEndpointBehavior" binding="wsHttpBinding"
                bindingConfiguration="WSHttpBinding_CalculatorService" contract="ServiceReference1.CalculatorService"
                name="WSHttpBinding_CalculatorService">
                <identity>
                    <servicePrincipalName value="host/it10" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

IIS中把配置站点端口为96

tcpTrace配置

Listen on Port # : 100
Destination Server: localhost
Destination Port# :96

WCF.rar
tcpTrace.rar



签名:删除冗余的代码最开心,找不到删除的代码最痛苦!
原文地址:https://www.cnblogs.com/season2009/p/3454123.html