如何在.aspx页上检查Web服务状态 [英] How to check webservice status on .aspx page

查看:98
本文介绍了如何在.aspx页上检查Web服务状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Web服务,可以将数据从一个数据库存储到另一个数据库.现在,我想知道.aspx页面上的Web服务状态,即它是否正常工作.我也想在按钮单击事件上启动和停止Webservice.如果是,那么请如何医治我.

I have created a webservic which store data from one database to another. Now i want to know my webservice status on .aspx page means it is working or not. And also i want start and stop webservice on button click event. If yes then how please healp me.

推荐答案



您可以使用我的代码检查特定的Web服务是否存在

Hi,

You can check particular web service is exists or not by using my code

WebRequest req = WebRequest.Create("http://www.webservicex.net/ConvertAcceleration.asmx");
 try
 {
     WebResponse res = req.GetResponse();
 }
 catch (Exception es)
 {
     //Handle that here
 }



如果您输入了错误的Web服务URL,则只会引发Exception.在该catch方法中,您可以编写用户友好的msg


您可以使用dispose方法禁用Webservice.对此不确定的是

但您可以尝试.

您可以禁用和启用本地网站中的Web服务.

我在这里提供一些链接,以了解有关Web服务的更多信息.

http://msdn.microsoft.com/en-us/library/ms972326.aspx


最好的



If you give wrong webservice url it just raise Exception.In that catch method you can write user friendsly msg


And you can use dispose method to disable webservice .Am not sure about this

but you can try that .

You can disable and enable webservice which is in your local website.

Here I''m providing some links to understand more about webservices.

http://msdn.microsoft.com/en-us/library/ms972326.aspx


All the Best


尝试:

System.ServiceProcess.ServiceController sc =新的System.ServiceProcess.ServiceController("myService");
返回sc.Status;
try:

System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController("myService");
return sc.Status;


这篇关于如何在.aspx页上检查Web服务状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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