How to add wcf service at runtime

前端 未结 3 1578
没有蜡笔的小新
没有蜡笔的小新 2021-01-16 16:27

How can i add wcf service at runtime in my winform UI. I created a wcf service which return running processes of hosted machine. I want to add the hosted machine service in

3条回答
  •  鱼传尺愫
    2021-01-16 17:04

    You need to change endpoints dynamically at runtime, so You need WCF Discovery.

    Structure :

    WCF Consumer(s) <---> WCF Discovery Service <---> WCF Service(s)
    

    Implementation :

    1. How to: Implement a Discovery Proxy
    2. How to: Implement a Discoverable Service that Registers with the Discovery Proxy
    3. How to: Implement a Client Application that Uses the Discovery Proxy to Find a Service

    Topology :

    • Start Discovery Service [ Structure BackBone ]
    • Start Service(s) [ Every Service will ANNOUNCE its startup to the Discovery Service ]
    • Start Client(s) [ Every Client will DISCOVER ( FIND & RESOLVE ) Services' endpoints from the Discovery Service ]

    Notes :

    • Discovery process uses UDP ( Check your Firewall, It can block connections )
    • Services MUST announce their startup, thus Self-Hosted services is OK, but IIS-Hosted 5/6 ones is NOT because they started automatically when 1st invoke happends !

    Solving IIS-Hosted 5/6 Issue :

    • By Extending Hosting Using ServiceHostFactory

    So that you can start your IIS-Hosted 5/6 services manually without being invoked for the first time


    You can also use WCF Routing Service.

    BROTHER TIP :
    Don't go far for a Serverless ( No-BackBone, No-BootleNeck, Fully-Distributed, .. etc ) ideal topology, this'll blowup your head and got you crazy :D

    For a beginner, I suggest you this tutorial [ WCF Tutorials ]

提交回复
热议问题