473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to start code when IIS starts - Any expert?

AW
Hello,

I have a method to initialize my application, which reads configuration
settings, establishes connections, and loads a bunch of data. It lasts for
several seconds.

This method is called in the Application_Start event, but this means that
the first person requesting for a page will undergo a severe wait.

Can someone recommend a way to do so that I can call this method BEFORE any
page is called? Do I have to plug into IIS and know when the server is
started?

Thanks,
AW
--
To reply, remove a "l" before the @ sign.

AW - MCT, MCSD.Net, MCAD.Net
Nov 17 '05 #1
4 1165
Your best bet is to do it the way you are doing it. The application will
only start when someone hits the page. It will also unload 20 minutes after
the last session is killed. This is an excellent way to do it in order to
get the memory management features and ensure application stability and
performance. Your best bet instead may be to have a windows task sitting
somewhere that just hits a particular page every 19 minutes. That way
ensuring that there's always a session in the application domain so it won't
unload and if a user hasn't hit the site yet the app will be forced to load.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Frontpage

"AW" <aw****@fr.xrt.com> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have a method to initialize my application, which reads configuration
settings, establishes connections, and loads a bunch of data. It lasts for
several seconds.

This method is called in the Application_Start event, but this means that
the first person requesting for a page will undergo a severe wait.

Can someone recommend a way to do so that I can call this method BEFORE any page is called? Do I have to plug into IIS and know when the server is
started?

Thanks,
AW
--
To reply, remove a "l" before the @ sign.

AW - MCT, MCSD.Net, MCAD.Net

Nov 17 '05 #2
AW
Thanks Mark for your answer.

I understand that it would be best to theoretically wait for the first user
to start the application, but practically this can't be tolerated because of
the several seconds needed for initialization.

The workaround that you mention seems like a good idea, but isn't it
possible to do something that's more tightly tied with IIS? I mean, instead
of making an HTTP request, can't I call directly an IIS API or, better an
ASP.Net API?

Thanks for your help.
--
To reply, remove a "l" before the @ sign.

AW - MCT, MCSD.Net, MCAD.Net
Nov 17 '05 #3
AW,

Here are some suggestions that may help your situation:

1.) Compile your .dll with the method you call in application_onstart into a
native image using ngen.

2.) Cache the data you retrieve and use either timespan or file dependencies
to refresh the cache appropriately.

That should give you some of the performance boost you're seeking.

Regards,

Bryce Budd
"AW" <aw****@fr.xrt.com> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have a method to initialize my application, which reads configuration
settings, establishes connections, and loads a bunch of data. It lasts for
several seconds.

This method is called in the Application_Start event, but this means that
the first person requesting for a page will undergo a severe wait.

Can someone recommend a way to do so that I can call this method BEFORE any page is called? Do I have to plug into IIS and know when the server is
started?

Thanks,
AW
--
To reply, remove a "l" before the @ sign.

AW - MCT, MCSD.Net, MCAD.Net

Nov 17 '05 #4
AW
Thanks Bryce.

These are good ways to speed up the initialization part, but still a good
part of the work can't be optimized (database connections establishment, for
instance). So I really need a way to do this part of the work *before*
anybody uses the application, instead of just speeding it up.
--
To reply, remove a "l" before the @ sign.

AW - MCT, MCSD.Net, MCAD.Net
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joeandtel | last post by:
Is there a way to start the Primary Auto_Number at a specific number? Usually it starts at 1, but I would like to have it start at 5,000
4
by: Dao | last post by:
I have created a windows service called MyService. I followed the MSDN sample code to add the following code but it did not work. What I tried was that to start another or external program when...
10
by: amirmira | last post by:
I have a Windows Service developed in VB.NET that attempts to connect to a database as soon as the service starts. I have no problem when I start the service manually - but when I restart the...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
2
by: martin1 | last post by:
All, timer interval is 60 sec, i want ot set up timer start 15 sec later after minute. for example if current time is 2:30:00, the timer starts 2:30:15, then timer loop procedure every minute...
9
by: martin1 | last post by:
Hi, All, My question is how to set up timer start 15 sec past minute. It always start 15 sec past minute. For example, if current time is 8:30:45, the timer starts on 8:31:15 am; if current...
3
by: illegal.prime | last post by:
Hi all, I have a service that needs to start a regular windows application. I'm running the service as ServiceAccount.LocalSystem. But, when it starts the process (using Process.Start) the GUI...
6
by: buffinator | last post by:
I have two applications that should work together, let's call them A and B. The first time A starts, it should open a B process and start communicating with it. All other times an A instance...
0
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
My program needs to do X when someone 'starts using' their Windows user account, and it should do Y when they 'stop using' their Windows user account. By 'starts using' I mean they log on, unlock...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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...

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.