• 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>

  • 相关阅读:
    Python学习日记(一)——初识Python
    读《乌合之众》
    用WPF做了几个小游戏
    《HeadFirst设计模式》读后感——对学习设计模式的一些想法
    设计模式C#实现(九)——工厂方法模式和简单工厂
    设计模式C#实现(八)——原型模式
    设计模式C#实现(七)——生成器模式
    设计模式C#实现(六)——单例模式
    《小强升职记》读后感和思维导图
    《魔鬼搭讪学》《魔鬼约会学》读后感
  • 原文地址:https://www.cnblogs.com/Winston/p/1157504.html
Copyright © 2020-2023  润新知