473,503 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatic WebService Start

4 New Member
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?
Nov 23 '09 #1
11 4121
ThatThatGuy
449 Recognized Expert Contributor
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 !!!!!
Nov 23 '09 #2
shreears
4 New Member
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.......?
Nov 23 '09 #3
Frinavale
9,735 Recognized Expert Moderator Expert
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
Nov 23 '09 #4
Curtis Rutland
3,256 Recognized Expert Specialist
Ok. Basically, what a web service is, is a web application with very specific input/output. Now, a web app doesn't run until it is called. So, your timer won't start until the application is started via a web request.

Therein lies the problem using timers in an ASP.NET web service. It's simply not the best idea.

If it is possible, I would create a Windows service that does all the work that needs the timer, and let the web service act solely as a communications layer.
Nov 23 '09 #5
Atli
5,058 Recognized Expert Expert
Hey.

Im no exactly a IIS/ASP.Net/Web-Service expert (I'm more into penguins :P), but this sounds to me like tho sort of thing the Task Scheduler (Cron, to me) was made for; executing things periodically on a timer.

Couldn't you just write a script - to either do whatever your web-service is doing on the timer, or to test whether IIS went down and restart the timer - and schedule it for periodic execution using the Task Scheduler?

Writing a windows service seems like overkill to me.
Not that I actually know how to do that. Could be easy, I suppose xD
Nov 23 '09 #6
Curtis Rutland
3,256 Recognized Expert Specialist
The problem with the whole idea is that web services aren't really "services." They're basically web pages that expect a certain POSTed input, and return a response of specifically formatted XML.

Now, there is a component that runs in the background, but it's not something that you really "start." It's started when it's called via web request. So I guess you could just set up a script to do a web request, but it seems like the whole idea is faulty from the beginning.
Nov 23 '09 #7
Frinavale
9,735 Recognized Expert Moderator Expert
@insertAlias
I would never refer to a Web Service as "basically a web page". I guess this is because I learned about Web Services in Java and have a clear understanding that they are not web pages...They are completely different animals. Microsoft has done a wonderful job of blurring the lines between web pages, web services, and even between client/server by adding in functionality to let you call web services client side using Ajax. Although this has made things easier for developers, it also adds confusion as to what each component is, how they work, where/how they are supposed to be used etc.


Aside from that, I completely agree with you iA.
The OP has has a design flaw in which they have confused a web service with a windows service. Web services wait for a request, process the request, and send a response. They aren't supposed to be sitting in the background doing something in between requests. That's not their intended usage.

But, if the user doesn't want to redesign their web service to work as web services are intended to work then they are going to have to either write a Web Service (which does run in the background on the Windows Web Server...waiting for the IIS server to restart) or they are going to have to write a script as Atli has recommended. Either way I don't know how to do this and the question will have changed.

-Frinny
Nov 23 '09 #8
shreears
4 New Member
Hi Friends


I know that some request has to be send to webservice for intialis it....

But i need to do it from windows or IIS Automatically.....
Kindly come up with solutions...
Nov 24 '09 #9
Frinavale
9,735 Recognized Expert Moderator Expert
Did you read any of the posts in this thread?
We suggested quite a few possible solutions for you to consider.
What did you think of our suggestions?


-Frinny
Nov 24 '09 #10
shreears
4 New Member
Sorry i dont need of doing in Windows Service as suggested by above threads.
I need to do it in Web service itself. So i Searching For web Service itself..
Nov 25 '09 #11
Frinavale
9,735 Recognized Expert Moderator Expert
What you want is not possible.
Web Services are started when a request is made to them. They do not and cannot start before a request is made to them.

That is why we suggested using a Windows Service.
Nov 25 '09 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1599
by: shahrukh | last post by:
hi how can i debug my webservice, i cant use messagebox.show("variable values"); so how do i view if my variables have the correct values? any help appriciated thank you
1
1110
by: lemonworks | last post by:
I have a xsd and a wsdl File. Out of these two i generated a dll for the WebClient and a dll for the WebService. So far so good. When i trace the message the client generates, the soap-xml is...
6
4308
by: MA | last post by:
Hi all! I know there is other newsgroups for webservices, but I don´t get any answers on those. I have developed a webservice that writeing and reading files in different folders. Question...
2
1492
by: author | last post by:
Newbie Q... When I hit the "ws.asmx" in a browser, I get "Parser Error Message: Could not create type 'Service1'" ?? If I use the file "ws_ok.asmx" (without codebehind, but same code), I get...
1
2096
by: Nalaka | last post by:
Hi, I am testing with Visual studio 2005, web projects. Situation: I have one solution with two web projects, created as file system projects. (I am tesing using the built in server, not IIS)...
4
3300
by: Tim Gallivan | last post by:
Hello group, I'm trying to develop a proof of concept webservice which asynchronously calls a function in a DLL. The function raises an event when it is finished, and works when used as part of...
5
6891
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
5
6254
by: | last post by:
Hi, How long do webservice objects live for? In particular, if i have static variables filled with data from a static constructor in a webservice, how long will that data persist? thxs
1
1606
by: =?Utf-8?B?UHNldQ==?= | last post by:
Hello. System: Win XP Media Centre Edition – Service Pack 3 Somehow, I picked up a variant of VirtuMonde; Symantec Anti-virus, Spybot Search & Destroy etc did not locate it; I discovered it...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.