且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在运行时添加的WCF服务

更新时间:2023-12-06 15:14:22

您需要在运行时动态改变终点,所以你需要的 WCF发现

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

结构:

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

执行:

  1. 如何:实现一个发现代理
  2. 如何:实现一个可发现服务,与发现代理注册
  3. 如何:实现使用发现代理查找服务客户端应用程序一>
  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

拓扑结构:

  • 在启动搜索服务[结构骨干]
  • 在启动服务(S)每个服务将 ANNOUNCE 它启动时搜索服务]
  • 在启动客户端(图)每个客户端的发现查找&安培; 解析)服务,从搜索服务端点]
  • 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 ]

注:

  • 在探索过程中使用的 UDP (检查你的防火墙,它可以阻止连接)
  • 在服务必须公布他们的创业,从而自托管服务还算可以,但 IIS托管 5/6的人是不是因为他们自动启动,当第一次调用happends!
  • 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 !

解决IIS托管5/6问题:

Solving IIS-Hosted 5/6 Issue :

这样就可以不用在第一次被调用手动启动IIS托管5/6服务

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

您也可以使用 WCF路由服务

BROTHER提示:
不要走远了无服务器(无骨架,无BootleNeck,完全分布式,..等)理想的拓扑结构,这将爆破你的头,并得到你疯了:D

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

对于一个初学者,我建议你这个教程[ WCF教程]

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