Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / September 2005

Tip: Looking for answers? Try searching our database.

How to automatically start an ASP.NET Web Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Svante - 29 Sep 2005 09:39 GMT
A Web Service, or any ASP.NET application for that matter, is typically first
started on the first request to it.

I have a need for a Web Service to be automatically started, without
receiving a request first. I'd like to avoid having yet another application
as a service kick-starting the Web Service.

What is the best way to achieve the desired result? (Lets just assume that I
really, really, need to have the application start automatically, so we don't
need to discuss that).

Svante
rviray - 29 Sep 2005 17:27 GMT
Just to make sure...you want the web service to be initialized AFTER yo
do your deployment?  If so, how are you doing deployment (XCopy, Setu
Package, etc)

I like doing the XCopy method, because I can run it via a batch file
If I needed to kick off the initialization of the Web Service Afte
Deployment, then I would create a small EXE that I can call via th
Deployment Batch file that I already have and all that EXE does i
creates an HTTPRequest to your Web Service URL and waits for
response....

If I needed to do it on a scheduled basis, every so often (for whateve
reason...maybe to check availability), and I had SQL Server somewhere,
would create a DTS package / Scheduled Job and VBScript it...usin
MSXML2.XMLHTTP object...

If I didn't have a SQL server, I would create a windows servic
(similar to the KickOff.exe file that contacted the Web Service for th
First Time).

Does that help

--
rvira
Svante - 29 Sep 2005 19:45 GMT
(snip)
> Just to make sure...you want the web service to be initialized AFTER you
> do your deployment?  If so, how are you doing deployment (XCopy, Setup
> Package, etc)

I need it to be initialized very time IIS restarts and/or the application is
(re-)deployed. I.e. - it should always be running. After reboot, after
restart of IIS, after (re-)install etc. The manner of deployment is not of
concern here.

> I like doing the XCopy method, because I can run it via a batch file.
> If I needed to kick off the initialization of the Web Service After
[quoted text clipped - 13 lines]
>
> Does that help?

Sorry - not really. I don't need to have it started every minute or every
hour or whatever (yes, in practice it may in fact work, but it's not quite
what I need). It should be started as soon as that web site is started (and
of course after (re-)deployment too). A scheduled restart is just a kludge -
I'd like there to be a better way.

Svante
rviray - 29 Sep 2005 20:39 GMT
I guess my point is this...I don't believe that there is an intrinsi
tool (via .NET framework or Windows API) that will help, so we have t
build one...

so...if the client asked me to solve this issue, I would

1. Think about all the scenarios (or at least most of them) when you
application needs to be re-initialized.  You mentioned a few...when II
restarts, when you deploy, and other scenarios...

2. Are their any common event hooks or APIs that are called via .NE
CLR, Windows API or IIS API...that we can use to monitor and o
eventually tie into...

- for the .NET CLR there is a profiling tool that I have used in th
past to help troubleshoot issues with various applications...its prett
good to figure out what the CLR is doing at certain points in th
Application life cycle (I have never used it to see what it does t
determine if a web application needs to be initialized o
not...probably try to look at that this weekend)

http://msdn.microsoft.com/msdnmag/issues/01/12/hood/

- for the windows and IIS API calls, I never had to figure those out s
I don't have any resources off hand...

3. Once we figure out all the scenarios that need our attention alon
with figuring out what you need to tap into to...then we have to figur
out how to monitor it... that is how I came up with a Windows Service (
only mentioned SQL Scheduled Job because that is REAL easy to deploy, i
we were to just have an app contact the Web Service..to force
re-initialization if need be...not try to be a Kludge)...the Window
Service is probably one of the easiest thing to create...

Anyway, that is the thought process I would use to figure your issu
out

--
rvira
test@test.com - 30 Sep 2005 21:55 GMT
Can you give us an example of how you are going to use this?  

>(snip)
>> Just to make sure...you want the web service to be initialized AFTER you
[quoted text clipped - 31 lines]
>
>Svante

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.