开发者

Confirm process start in C#

I have 2 projects created in C# using VS 2010.Project "Y" is the WCF service having operation contracts defined.Project "X" accesses methods of "Y" . Now I have code to start WCF service in project "X". Now before accessing first method from WCF service I want to make sure it has started properly.This service is just a executable.

开发者_开发百科

How can I make sure executable is started properly?


What you're interested in is presumably whether the WCF service is genuinely up and running - not just whether the process is started. So I would find some way of checking that in a cheap and side-effect-free way. For example, you could potentially fetch the WSDL if it's a SOAP service, or even add an "is everything healthy?" service call.

You can check for the process itself using Process.GetProcessesByName if you really want - but personally I'd at least start with the service call, and maybe try to find the process for added diagnostics if the service appears not to be up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜