Endpoint

What is Endpoint
    Every service is associated with an address that defines where the service is. a binding that defines how to communicate with the service, and a contract that defines what the service does.and they are abbreviated as ABC. That is to say, the endpoint is the fusion(融合) of the address, contract, and binding
.
    every service must expose at least one business endpoint and each endpoint has exactly one contract. all endpoints on a service have unique address, and a a single service can expose multiple endpint.  we can configure endpoints either administratively ussing a config file or programmatically.

Administratively Endpoint configuration
     a) a sample about config the endpoints administratively through config file
    <system.serviceModel>
        <services>
            <service name="myservice">
                <endpoint
                    address="http://localhost:8000/myservice"
                    binding="wsHttpBinding"
                    contract="MyNamespace.IMycontract"
                />
                <endpoint
                    address="net.tcp://localhost:8001/myservice"
                    binding="netTcpBinding"
                    contract="MyNamespace.IMycontract"
                />
                <!--
                 you can also specify the relative address of the endpoint,
                 the two former endpoints specified the absolute address all
                -->
                <endpoint
                    address="myservice"
                    binding="wsHttpBinding"
                    contract="MyNamespace.IMycontract"
            />
            </service>
        </services>
    </system.serviceModel>
in this config file, we have exposed two endpoints in one WCF service.


Binding configuration
    we can use the config file to customize the binding used by the endpint. To that end, add the bindingConfiguration tag to the endpoint section, and name a customized section in the bindings section of the config file. the following demostrations using this technique to enable transaction propagation(繁殖,传送)

<system.serviceModel>
    <services>
        <service name="myservice">
            <endpoint
                address="net.tcp://localhost:8000/myservice"
                bindingConfiguration="TransactionalTCP"
                binding="tcpNetBinding"
                contract="IMycontract"
            />
        </service>
    </services>
    <bindings>
        <netTcpBinding>
            <binding 
            name="TransactionalTCP"
           transactionFlow="true"
            />        
        </netTcpBinding>
    </bindings>
</system.serviceModel>

转载于:https://www.cnblogs.com/Winston/archive/2008/04/17/1157504.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值