在开发环境中如何配置netTcp 绑定

可以参考http://www.cnblogs.com/webabcd/archive/2007/12/27/1017081.html

baseAddress 要设置成 http. 这样可以在添加服务引用中,自动配置.

http://localhost:8731 的端口和 net.tcp://localhost:54321 的端口不能相同

<configuration>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="wcfWinServer.AddServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="wcfWinServer.AddServiceBehavior"
                name="wcfWinServer.AddService">
                <endpoint address="net.tcp://localhost:54321/Binding/Hello" binding="netTcpBinding" contract="wcfWinServer.IAddService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8731/Design_Time_Addresses/wcfWinServer/AddService/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
</configuration>

posted @ 2011-01-31 10:29  Ken-Cai  阅读(287)  评论(0编辑  收藏  举报