Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automatically Start ASP.Net Applications / web services

0 views
Skip to first unread message

Bryan Wilkerson

unread,
Aug 30, 2001, 6:48:55 PM8/30/01
to
How do I get IIS to automatically load start my ASP .Net (web service)
application when it starts?

I have some logic in Global.Start() that needs to get kicked off right away.

I think I remember seeing this done a long time ago with an old (pre .Net)
ASP application. A better alternative would be a setting in Web.config.

Cheers,

Bryan Wilkerson
Staff Software Engineer
IAG/MSL/CME
Intel Corporation


Scott Swigart

unread,
Aug 31, 2001, 3:27:32 AM8/31/01
to
Your application starts on the first request. If you need to force it to
start, then you need to generate a request to the web app/service.

Scott Swigart
.NET Training and Consulting

3 Leaf Solutions, LLC
sc...@3leafsolutions.com
www.3leafsolutions.com


"Bryan Wilkerson" <bryan.p....@intel.com> wrote in message
news:9mmfrq$3...@news.or.intel.com...

CSharp Agentman

unread,
Aug 31, 2001, 1:53:15 PM8/31/01
to
Scott,

Can you provide some code or some complete instructions on how to do this.
Thanks in advance.


CA

"Scott Swigart" <sc...@3leaf.com> wrote in message
news:OF7Hw5eMBHA.864@tkmsftngp05...

Peter Torr (MS)

unread,
Sep 1, 2001, 1:30:21 PM9/1/01
to
"CSharp Agentman" <sql_ag...@hotmail.com> wrote in message
news:O0EeQakMBHA.1416@tkmsftngp03...

> Can you provide some code or some complete instructions on how to do
this.
> Thanks in advance.

Stick the following in a file called StartMySite.js:

var ie = new ActiveXObject("InternetExplorer.Application")
ie.Navigate("http://localhost/whatever")
WScript.Sleep(1000)
ie.Quit()

Then you can use whatever mechanism you want to run this file (Scheduled
task, Startup folder, Run RegKey, etc.).

You could also write a Service that made the request... seems like overkill
though. Is there a reason why it has to start as soon as the machine boots?
Would it be better served by a traditional Windows Service?

Peter

--
Peter Torr -- pt...@microsoft.com -- JScript .NET / VSA Runtime
Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
Please post all questions to the group. Thanks.

CSharp Agentman

unread,
Sep 1, 2001, 5:46:08 PM9/1/01
to
Peter,

How do you start a process (exe file for example) from ASP.NET and leave it
alone to do its own thing.
I don't want any return values etc.. I want the exe etc.. to run
independently outside the ASP.NET Process.
What do you recommend.??? Also I want the exe to quite and die when it is
done.

Thanks for your help


CA


"Peter Torr (MS)" <pt...@microsoft.com> wrote in message
news:OpAAIvwMBHA.1444@tkmsftngp03...

Peter Torr (MS)

unread,
Sep 2, 2001, 5:55:34 PM9/2/01
to
"CSharp Agentman" <sql_ag...@hotmail.com> wrote in message
news:uR36GBzMBHA.380@tkmsftngp03...

> How do you start a process (exe file for example) from ASP.NET and leave
it
> alone to do its own thing.

Hi,

You can try something like this:

var p : Process = new Process;
var i : ProcessStartInfo = new ProcessStartInfo("peverify.exe")
i.Arguments = "/nologo \"" + name + "\"";
i.RedirectStandardOutput = true
i.UseShellExecute = false
i.CreateNoWindow = true
p.StartInfo = i;
p.Start();
if (p.WaitForExit(10000))
{
print("Done")
}
else
{
p.Kill()
print("Did not exit in a timely manner")
}
}
finally
{
if (p)
p.Dispose()
}

This sample also re-directs the output so you can read it later if you want.
It need to be run on its own thread because of the blocking call to
WaitForExit and the redirection. You could of course just ignore the process
and do nothing about it...

Bryan Wilkerson

unread,
Sep 5, 2001, 1:15:32 PM9/5/01
to
The ability to configure an ASP.Net application to load automatically
everytime IIS is started would be a valuable addition to ASP.Net for both
web services and web applications.

Not to throw stones, but this is a feature that most of the JSP engines have
had for some years now.

-bryan

"Peter Torr (MS)" <pt...@microsoft.com> wrote in message
news:OpAAIvwMBHA.1444@tkmsftngp03...

Bryan Wilkerson

unread,
Sep 6, 2001, 12:48:33 PM9/6/01
to

"Peter Torr (MS)" <pt...@microsoft.com> wrote in message
news:OpAAIvwMBHA.1444@tkmsftngp03...
>

> Then you can use whatever mechanism you want to run this file (Scheduled
> task, Startup folder, Run RegKey, etc.).

None of those machanisms is triggered by a restart of IIS.

>
> You could also write a Service that made the request... seems like
overkill
> though. Is there a reason why it has to start as soon as the machine
boots?

It needs to register itself as being available to service requests with a
broker.

> Would it be better served by a traditional Windows Service?

Yes, but then it wouldn't have all of the advantages that being a Web
Service brings to bear on the problem domain.

>
> Peter

I appreciate your time to answer these questions Peter. I think there are
many different use cases where you will find ASPX applications & web
services that need Global.Application_Start to be fired everytime IIS is
started. The most basic use of this event is to setup connections to other
resources (RDBMS, etc.) Is it desirable that the first user to hit the site
incur the overhead of these operations? I suspect not.

-bryan


0 new messages