WEB开发网
开发学院WEB开发ASP.NET 稳扎稳打Silverlight(53) - 4.0通信之对WCF NetTc... 阅读

稳扎稳打Silverlight(53) - 4.0通信之对WCF NetTcpBinding的支持

 2010-10-12 12:30:06 来源:WEB开发网   
核心提示: App.config代码<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services> <

App.config

代码<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <services>
            <!--
                元数据地址:http://localhost:12345/SocketServer/Duplex/mex
                TCP 地址:net.tcp://localhost:4502/SocketServer/Duplex
                TCP 端口限制在 4502 - 4534 之间
            -->
            <service name="SocketServer.Duplex">
                <endpoint address="SocketServer/Duplex" binding="customBinding" contract="SocketServer.IDuplex" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:12345/SocketServer/Duplex" />
                        <add baseAddress="net.tcp://localhost:4502/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
       
        <!--
            Silverlight 4.0 对 NetTcpBinding 的支持是通过自定义绑定的方式来实现的。服务端和客户端都需要使用自定义绑定
        -->
        <bindings>
            <customBinding>
                <binding>
                    <binaryMessageEncoding></binaryMessageEncoding>
                    <tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
                </binding>
            </customBinding>
        </bindings>
       
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>

上一页  1 2 3 4 5 6 7  下一页

Tags:稳扎稳打 Silverlight 通信

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接