自动WebService启动 [英] Automatic WebService Start

查看:144
本文介绍了自动WebService启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的asp.net应用程序创建了一个web服务。我也在IIS中发布了我的Web服务。我在webservice中使用了一个计时器。但是当系统重新启动时,服务停止或计时器停止。如何在系统重启后自动启动?

I have created a webservice for my asp.net application. I published my Webservice in IIS also.I have used a timer inside webservice. But when the system get restarted the service get stopped or timer get stopped. How to start it automatically after the system get restarted?

推荐答案

嘿shreears .....我觉得你在 windows服务之间感到困惑网络服务 ....


在系统启动时启动或停止的Windows服务.... Windows服务是为桌面应用程序构建的....


虽然Web服务是用于在

web ....或IIS中托管的网站或Web应用程序供本地使用....


当您通过IIS或Visual Studio运行WebSite时......您可以调用Web服务的所有方法....它不会不需要开始或停止....


得到它好友!!!!!
Hey shreears..... i think you''re confused between windows services and web services....

It''s Windows service that''s gets started or stopped at system start.... and windows services are built for Desktop Applications....

While Webservices are for the websites or webapplications hosted on the
web.... or in IIS for local use....

When you run your WebSite through IIS or Visual Studio .... you can call all of the methods of the Web service.... it doesn''t needs to be started or stopped....

got it buddy !!!!!



< b / b
你回复它


实际上我的网络服务中有一个timercontrol。

所以当我重新启动IIS时计时器控制停止。

因此我需要再次启动那个webservice中的计时器

如果IIS重新启动怎么办.......?
Hi

thk u for replying it

Actually i am having a timercontrol inside my webservice.
So when ever i restart the IIS that timer control get stopped.
Hence i need to again startup that timer in webservice
how to do it if the IIS get restarted.......?


这是一个非常有趣的问题。 />

我建议您创建一个Windows服务应用程序来监视IIS重新启动的时间....如果它重新启动,那么它将不得不向您的Web服务发送请求重新启动"它。


我不知道你将如何实现这个Windows服务。


或者你可以在这样的情况下重新设计你的Web服务它不需要定时器控制的方式。而不是让计时器控制做任何事情,你可以重新设计你的web服务来完成每个连接的这个过程....


如果有很多连接并且这个过程使用了很多然后,具有一个静态变量,该静态变量包含最后一次刷新时的日期/时间。是......首先检查该值,并且只有在自上次执行该过程后 x 时间过去时才进行连接。


-Frinny
This is a very interesting problem.

I recommend that you create a Windows Service application that monitors when IIS is restarted....if it''s restarted then it will have to send a request to your Web Service to "restart" it.

I have no idea how you would implement this Windows Service.

Alternatively you could re-design your Web Service in such a way that it doesn''t require the timer control. Instead of having the timer control doing whatever, you could redesign your web service to do this process every connection....

If there are a lot of connections and this process uses a lot of resources, then have a static variable that contains a date/time of when the last "refresh" was....check that value first and only do the process when a connection is made if x amount of time has past since the last time the process was executed.

-Frinny


这篇关于自动WebService启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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