• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

application restart

hi all :)
i have a C# compiled assembly under myWebApp\bin
i am able to call the classes from the namespaces in the dll.
the global.asax application onStart contains a code line that initialize some static classes in the dll:
<%@ Import namespace="com.tm.application" %>

     <script language="C#" runat="server">
         
          public void Application_OnStart()
          {
                TMApplication.init();
          }

     </script>
the problem is that EVERY time i refresh the aspx page that calls classes in the dll
the Application_OnStart is invoked and my application inits.
10x.
0
shez
Asked:
shez
  • 6
  • 5
1 Solution
 
avnerCommented:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_olemsg_the_application_onstart_function.asp

The application_onstart should run "any .asp files are processed "


What is it that you try to do ?
0
 
thomasdoddsCommented:
set a session variable as a flag ans check for it in the onstart sub... refreshing a page doesn't reset the session, so you should be able to control the firing of your code

"the problem is that EVERY time i refresh the aspx page " ... that's the way it's designed to work ... if you refresh the page you refresh the application, but not the session
0
 
shezAuthor Commented:
as far as i understand it the Application_OnStart event is fired only 1 time in the application life cycle.
maybe i got it wrong but it seems absurd that every request
will restart the application.

loading each user(session) with a flag couldn't be the right solution.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
shezAuthor Commented:
as far as i understand it the Application_OnStart event is fired only 1 time in the application life cycle.
maybe i got it wrong but it seems absurd that every request
will restart the application.

loading each user(session) with a flag couldn't be the right solution.
0
 
avnerCommented:
I was unable to find a clear answer, but maybe you need to look into the direction of how the "default application" is defined in your IIS.
0
 
shezAuthor Commented:
i got it :)
asp.net constantly monitors all file types under \bin.
any changes to these files causes the application to restart which makes sense cause \bin is the app dir.
all my log files were written to \bin\logs.
so this what happened:
1. asp application started.
2. Application_OnStart called.
3. dll initialized.
4. during dll init log file written.
5. asp application restarted.

what do i do with the points now?
0
 
avnerCommented:
If what you are suggesting is right, then what if you write the logs to any directory that is not under \bin ?
0
 
shezAuthor Commented:
already did avner.
0
 
avnerCommented:
And did it work ?
0
 
shezAuthor Commented:
yep.
you want the points abe?
0
 
avnerCommented:
Yes. But this is only if I helped you getting to a solution.
0
 
avnerCommented:
Thanks .
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now