简体   繁体   English

WCF Web服务监视其他WCF Web服务

[英]WCF web service watching other WCF web services

I would like to have a Traffic COP or Controller WCF Web Service that doesn't do anything with data but instead gives orders to another WCF Web Service to do so. 我想要一个流量COP或控制器WCF Web服务,它不对数据做任何事情,而是向另一个WCF Web服务发出命令。

Could someone give me an example of how this might be able to be done. 有人可以给我一个例子,说明如何做到这一点。 It would be preferable that I was not getting into any APM stuff. 最好不要参加任何APM方面的工作。 Instead just an observer who later gets to spin another one way contract to a WCF Web Service when it needs to after it sees that there are no more other WCF Web Services with the same meta data in memory or processing currently. 取而代之的是,只有观察者后来发现需要在内存或处理中不再具有相同的元数据的其他WCF Web服务之后,才需要与WCF Web服务旋转另一种方式。

If this is impossible please say so. 如果不可能,请这样说。 Unless you know a small example of how it is done. 除非您知道如何完成此操作的一个小例子。 Maybe a pointer where somebody has already covered the topic? 也许是有人已经涵盖了该话题的指针?

Thanks apolfj 谢谢阿波菲

I don't really understand your question, but maybe this will help: 我不太了解您的问题,但这也许会有所帮助:

  • MSE is a "service virtualization" approach MSE是一种“服务虚拟化”方法
  • Stocktrader has a WCF load balancer included in it. Stocktrader包含WCF负载平衡器。

Maybe one of them will fit your needs. 也许其中之一会满足您的需求。

Having a 'traffic cop' service that all traffic goes through before it gets to the actual web service for processing will add extra overhead to your solution. 拥有一个“交通警察”服务,所有交通在到达实际Web服务之前都经过处理,这将增加解决方案的额外开销。 Then you also have issues like once you've logged a call going to a particular web service, how do you find out if the response was successful? 然后,您还遇到一些问题,例如,一旦记录到特定Web服务的呼叫,如何确定响应是否成功? Then you hvae to do more logging of some sort and finally return the result to the client. 然后,您需要做更多的日志记录,最后将结果返回给客户端。 If I understand what you were saying correctly (which I'm not entirely sure I do) you would be looking at something like; 如果我理解您说的正确(我不太确定我是这么做的),那么您将看到类似的内容;

Client -> TrafficCop -> Service1
Client -> TrafficCop -> Service2

OR 要么

Client -> Service1 -> TrafficCop

...depending on where you want the entry point and what you need to do. ...取决于所需的切入点和所需的操作。

I would probably remove the traffic cop web service entirely and implement some API's for your service to implement and have each web service log some information before a service operation is called and after the operation has completed. 我可能会完全删除traffic cop Web服务,并为您的服务实现一些API,以在调用服务操作之前和操作完成之后使每个Web服务记录一些信息。 I'd recommend you take a look at this link; 我建议您看一下此链接; http://msdn.microsoft.com/en-us/magazine/cc163302.aspx which covers behaviours, operation invokers and paramter inspectors. http://msdn.microsoft.com/zh-cn/magazine/cc163302.aspx ,其中涵盖了行为,操作调用程序和参数检查程序。

This way each web service can log information, check access, rules, report errors before and after execution to a database or another TrafficCop web service if you really want. 这样,每个Web服务就可以在执行之前和之后记录信息,检查访问权限,规则,将错误报告给数据库或另一个TrafficCop Web服务(如果您确实需要)。 But I'd probably be inclined to just stick all that information in its own database. 但是我可能倾向于将所有这些信息粘贴到自己的数据库中。 Thus each web service (depending on what you're doing) may have connections to two databases. 因此,每个Web服务(取决于您的工作)可能具有到两个数据库的连接。 One for the web service itself (if that's needed) and one to the TrafficCop / logging database. 一种用于Web服务本身(如果需要),另一种用于TrafficCop /日志数据库。

At a later date you then may choose to add a website that pulls all the information out of the traffic cop database and allows you to easily browse / search it. 然后,您以后可以选择添加一个网站,将所有信息从交通警察数据库中提取出来,并允许您轻松浏览/搜索。 It could highlight warnings or other issues your web services logged. 它可能突出显示您的Web服务记录的警告或其他问题。

Summary 摘要

If all you need to do is logging and related functionality I would consider having each web service log and / or check rules and other things before and / or after a service operation is invoked. 如果您需要做的只是日志记录和相关功能,那么我将考虑在调用服务操作之前和/或之后使每个Web服务日志和/或检查规则和其他内容。 At a later date you could consider adding an admin site that surfaces all this information so you can easily keep an eye on how your web services are performing. 日后,您可以考虑添加一个显示所有这些信息的管理站点,以便您可以轻松地监视Web服务的性能。 You may even like to log information like how long it takes to respond to certain requests. 您甚至可能希望记录信息,例如响应某些请求需要多长时间。

If this is not what you are after I would suggest you add more information and continue to keep your original question up to date. 如果这不是您想要的,我建议您添加更多信息,并继续保持原始问题的最新状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM