简体   繁体   中英

WCF Custom Service Behaviour

Context: I am hosting a number of services using WCF. I'd like for each of them to support a Ping operation (heartbeat, keep-alive, whatever...). But, I'd rather not go implement IPingable on each one. Instead, I'd love to do something like the serviceMetadata behavior does and dynamically add a channel dispatcher. This would mean all I'd need to do is add a pingable behvaior to the services and this operation is supported.

Any ideas? I've looked through the the source code of serviceMetadata and there is all kinds of internal stuff being called I don't have access to. Also, there may be an easier way.

Thanks for your time.

Just off the top of my head could you add a dispatch behaviour that would handle the call and spoof the return true/false?

I also found the following

如果您是通过行为来完成的,那么您的元数据是否会表明Ping操作存在?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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