如何检查是否一个Web服务并没有使用ping运行? [英] How to check if a web service is up and running without using ping?

查看:159
本文介绍了如何检查是否一个Web服务并没有使用ping运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查是否在Web服务的方法工作正常与否?我不能用ping。我还是要检查任何一种方法从客户端的Web服务被调用。我知道这是很难一概而论,但应该有一些方法。

How can i check if a method in a web service is working fine or not ? I cannot use ping. I still want to check any kind of method being invoked from the web service by the client. I know it is difficult to generalize but there should be some way.

推荐答案

要知道,如果一个Web服务方法正在精的唯一方法是调用方法,然后评估是否结果是细。如果你想保留的记录,精与时间,然后才能登录评估的结果。

The only way to know if a web service method is working "fine" is to call the method and then to evaluate whether the result is "fine". If you want to keep a record of "fine" vs. time, then you can log the result of the evaluation.

有就是要做到这一点没有更普遍的方式,使任何意义。试想一下:

There's no more general way to do this that makes any sense. Consider:


  1. 您可以有创建一个HTTP连接服务端点代码,但成功并不告诉你该服务是否会立即只要你发送的任何消息抛出异常。

  2. 您可以连接并发送一个无效的消息,但不告诉你了。

  3. 您可以连接并发送一个有效的消息,然后检查结果以确保它是有效的。这会给你一个不错的主意,当一个真正的客户端调用服务随即,真正的客户应该期待一个有效的结果。

  4. 除非服务需要,作为一个契机,死机,就是要故意刁难你!

  1. You could have code that creates an HTTP connection to the service endpoint, but success doesn't tell you whether the service will immediately throw an exception as soon as you send it any message.
  2. You could connect and send it an invalid message, but that doesn't tell you much.
  3. You could connect and send it a valid message, then check the result to ensure that it is valid. That will give you a pretty good idea that when a real client calls the service immediately afterwards, the real client should expect a valid result.
  4. Unless the service takes that as an opportunity to crash, just to spite you!

最好的方法是使用WCF跟踪(可能与消息级别的跟踪)登录实际上发生了什么的服务,好或坏。然后,人类可以看一下日志,看看他们是精。

The best technique would be to use WCF tracing (possibly with message-level tracing) to log what actually happens with the service, good or bad. A human can then look at the logs to see if they are "fine".

这篇关于如何检查是否一个Web服务并没有使用ping运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆