473,503 Members | 12,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT: Application_Start - doesn't fire

I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows
Server 2003 production server. 3 of them work fine. I just installed the 4th
one and it's Application_Start event is not firing.

I have double-checked everything (and rechecked) and I haven't found
anything that would explain why the Application is not starting.

Here is what I have done so far to troubleshoot this:

In IIS Manager I have ensured that there is a unique Application name in the
Home Directory tab of the Properties for the Web site in question. I have
verified that the home directory path is specified correctly. All other
properties in IIS have identical values to the other sites that do work
corectly (or have site-specific values that make sense). I have stopped and
started the Web site via IIS Manager. I have verified correct content in
Web.config (which is virtually identical to the other site's Web.config
files). I have saved changes to Web.config in an effort to get the
application to restart. I have recompiled and reinstalled the dll.

I have verified that this particular Web app is in fact online and
functioning to some extent. This particular Web application connects to a
database (per settings in Web.config). I have verified that the application
is, in fact, connecting to the database because I was able to log in (and
the credentials are verified against a table in the database). Furthermore,
the Web site will serve up pages. I put in a simple "hello world!"
default.aspx which is served correctly. I also put in my standard
default.aspx which hits the database (and verified that it hit the database
when the page was requested). I will note that whenever *any* page is first
requested that I get a general HTTP exception - but on the second request
the page is served as expected. So, this Web site is online and "mostly"
available. The whole problem is that Application_Start does not fire - which
is a big problem because that's when I load important variables into the
Application state.

FWIW: Toward fixing this I created a new application pool via IIS Manager
and placed the Web application into it (and stopped/restarted the Web
site)... still no dice.

Any ideas for troubleshooting this? I really need Application_Start to fire.
Thanks!
Nov 19 '05 #1
7 2428
One more observation:
When I have a simple default.htm - that page gets served just fine on the
first request. When I have a simple default.aspx - it chokes. So that tells
me it's something about asp.net.

Still needing ideas here... thanks.
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows
Server 2003 production server. 3 of them work fine. I just installed the
4th one and it's Application_Start event is not firing.

I have double-checked everything (and rechecked) and I haven't found
anything that would explain why the Application is not starting.

Here is what I have done so far to troubleshoot this:

In IIS Manager I have ensured that there is a unique Application name in
the Home Directory tab of the Properties for the Web site in question. I
have verified that the home directory path is specified correctly. All
other properties in IIS have identical values to the other sites that do
work corectly (or have site-specific values that make sense). I have
stopped and started the Web site via IIS Manager. I have verified correct
content in Web.config (which is virtually identical to the other site's
Web.config files). I have saved changes to Web.config in an effort to get
the application to restart. I have recompiled and reinstalled the dll.

I have verified that this particular Web app is in fact online and
functioning to some extent. This particular Web application connects to a
database (per settings in Web.config). I have verified that the
application is, in fact, connecting to the database because I was able to
log in (and the credentials are verified against a table in the database).
Furthermore, the Web site will serve up pages. I put in a simple "hello
world!" default.aspx which is served correctly. I also put in my standard
default.aspx which hits the database (and verified that it hit the
database when the page was requested). I will note that whenever *any*
page is first requested that I get a general HTTP exception - but on the
second request the page is served as expected. So, this Web site is online
and "mostly" available. The whole problem is that Application_Start does
not fire - which is a big problem because that's when I load important
variables into the Application state.

FWIW: Toward fixing this I created a new application pool via IIS Manager
and placed the Web application into it (and stopped/restarted the Web
site)... still no dice.

Any ideas for troubleshooting this? I really need Application_Start to
fire.
Thanks!

Nov 19 '05 #2
>So that tells me it's something about asp.net.
Nope, asp.net is not responsible for serving htm files by default.

Your application start is firing correctly because you can request a page.
Your logic and steps you have taken does not indicate a problem with your
application_start handler. Rather, the problem seems to be with the code
that fires inside the application_start handler. Try re-writing with some
error handling code first to see what gives.
--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
One more observation:
When I have a simple default.htm - that page gets served just fine on the
first request. When I have a simple default.aspx - it chokes. So that
tells me it's something about asp.net.

Still needing ideas here... thanks.
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows
Server 2003 production server. 3 of them work fine. I just installed the
4th one and it's Application_Start event is not firing.

I have double-checked everything (and rechecked) and I haven't found
anything that would explain why the Application is not starting.

Here is what I have done so far to troubleshoot this:

In IIS Manager I have ensured that there is a unique Application name in
the Home Directory tab of the Properties for the Web site in question. I
have verified that the home directory path is specified correctly. All
other properties in IIS have identical values to the other sites that do
work corectly (or have site-specific values that make sense). I have
stopped and started the Web site via IIS Manager. I have verified correct
content in Web.config (which is virtually identical to the other site's
Web.config files). I have saved changes to Web.config in an effort to get
the application to restart. I have recompiled and reinstalled the dll.

I have verified that this particular Web app is in fact online and
functioning to some extent. This particular Web application connects to a
database (per settings in Web.config). I have verified that the
application is, in fact, connecting to the database because I was able to
log in (and the credentials are verified against a table in the
database). Furthermore, the Web site will serve up pages. I put in a
simple "hello world!" default.aspx which is served correctly. I also put
in my standard default.aspx which hits the database (and verified that it
hit the database when the page was requested). I will note that whenever
*any* page is first requested that I get a general HTTP exception - but
on the second request the page is served as expected. So, this Web site
is online and "mostly" available. The whole problem is that
Application_Start does not fire - which is a big problem because that's
when I load important variables into the Application state.

FWIW: Toward fixing this I created a new application pool via IIS Manager
and placed the Web application into it (and stopped/restarted the Web
site)... still no dice.

Any ideas for troubleshooting this? I really need Application_Start to
fire.
Thanks!


Nov 19 '05 #3
Thanks Alvin.

A couple of things.
I have a version installed right now that has *all* of the Application_Start
and all of the Session_Start logic (just to ensure that something wasn't
interacting with the new/current Session) commented out - thereby
eliminating the possibility of logic problems, AFAIK.

Since last post I have rebooted the server. Still no dice.

<< Nope, asp.net is not responsible for serving htm files by default.>>
Right... that's why I put an default.html file in. I thought that would tell
me if there was a problem with the Web site (independent of ASP.NET) or if
there was something going on with ASP.NET. So, unless I'm mistaken, I think
I have narrowed it down to "something with ASP.NET or with my application
logic" and not a problem with the Web site, itself or IIS - because the
default.html file was served just fine, but the simple default.aspx was not.

At this point I'm thinking about killing the site and recreating it from
scratch... but I hate to do that because even if the problem - whatever it
was - goes away, I don't have the opportunity to know what went wrong.
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
So that tells me it's something about asp.net.

Nope, asp.net is not responsible for serving htm files by default.

Your application start is firing correctly because you can request a page.
Your logic and steps you have taken does not indicate a problem with your
application_start handler. Rather, the problem seems to be with the code
that fires inside the application_start handler. Try re-writing with some
error handling code first to see what gives.
--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
One more observation:
When I have a simple default.htm - that page gets served just fine on the
first request. When I have a simple default.aspx - it chokes. So that
tells me it's something about asp.net.

Still needing ideas here... thanks.
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows
Server 2003 production server. 3 of them work fine. I just installed the
4th one and it's Application_Start event is not firing.

I have double-checked everything (and rechecked) and I haven't found
anything that would explain why the Application is not starting.

Here is what I have done so far to troubleshoot this:

In IIS Manager I have ensured that there is a unique Application name in
the Home Directory tab of the Properties for the Web site in question. I
have verified that the home directory path is specified correctly. All
other properties in IIS have identical values to the other sites that do
work corectly (or have site-specific values that make sense). I have
stopped and started the Web site via IIS Manager. I have verified
correct content in Web.config (which is virtually identical to the other
site's Web.config files). I have saved changes to Web.config in an
effort to get the application to restart. I have recompiled and
reinstalled the dll.

I have verified that this particular Web app is in fact online and
functioning to some extent. This particular Web application connects to
a database (per settings in Web.config). I have verified that the
application is, in fact, connecting to the database because I was able
to log in (and the credentials are verified against a table in the
database). Furthermore, the Web site will serve up pages. I put in a
simple "hello world!" default.aspx which is served correctly. I also put
in my standard default.aspx which hits the database (and verified that
it hit the database when the page was requested). I will note that
whenever *any* page is first requested that I get a general HTTP
exception - but on the second request the page is served as expected.
So, this Web site is online and "mostly" available. The whole problem is
that Application_Start does not fire - which is a big problem because
that's when I load important variables into the Application state.

FWIW: Toward fixing this I created a new application pool via IIS
Manager and placed the Web application into it (and stopped/restarted
the Web site)... still no dice.

Any ideas for troubleshooting this? I really need Application_Start to
fire.
Thanks!



Nov 19 '05 #4
in your application start handler, send an email to yourself
using the system.web.mail functionality. run the app and see if you get an
email.

if you don't get an email, you will need to attach a debugger to the worker
process on the server to find out exactly what is going on.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Thanks Alvin.

A couple of things.
I have a version installed right now that has *all* of the
Application_Start and all of the Session_Start logic (just to ensure that
something wasn't interacting with the new/current Session) commented out -
thereby eliminating the possibility of logic problems, AFAIK.

Since last post I have rebooted the server. Still no dice.

<< Nope, asp.net is not responsible for serving htm files by default.>>
Right... that's why I put an default.html file in. I thought that would
tell me if there was a problem with the Web site (independent of ASP.NET)
or if there was something going on with ASP.NET. So, unless I'm mistaken,
I think I have narrowed it down to "something with ASP.NET or with my
application logic" and not a problem with the Web site, itself or IIS -
because the default.html file was served just fine, but the simple
default.aspx was not.

At this point I'm thinking about killing the site and recreating it from
scratch... but I hate to do that because even if the problem - whatever it
was - goes away, I don't have the opportunity to know what went wrong.
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
>So that tells me it's something about asp.net.

Nope, asp.net is not responsible for serving htm files by default.

Your application start is firing correctly because you can request a
page. Your logic and steps you have taken does not indicate a problem
with your application_start handler. Rather, the problem seems to be with
the code that fires inside the application_start handler. Try re-writing
with some error handling code first to see what gives.
--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
One more observation:
When I have a simple default.htm - that page gets served just fine on
the first request. When I have a simple default.aspx - it chokes. So
that tells me it's something about asp.net.

Still needing ideas here... thanks.
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows
Server 2003 production server. 3 of them work fine. I just installed the
4th one and it's Application_Start event is not firing.

I have double-checked everything (and rechecked) and I haven't found
anything that would explain why the Application is not starting.

Here is what I have done so far to troubleshoot this:

In IIS Manager I have ensured that there is a unique Application name
in the Home Directory tab of the Properties for the Web site in
question. I have verified that the home directory path is specified
correctly. All other properties in IIS have identical values to the
other sites that do work corectly (or have site-specific values that
make sense). I have stopped and started the Web site via IIS Manager. I
have verified correct content in Web.config (which is virtually
identical to the other site's Web.config files). I have saved changes
to Web.config in an effort to get the application to restart. I have
recompiled and reinstalled the dll.

I have verified that this particular Web app is in fact online and
functioning to some extent. This particular Web application connects to
a database (per settings in Web.config). I have verified that the
application is, in fact, connecting to the database because I was able
to log in (and the credentials are verified against a table in the
database). Furthermore, the Web site will serve up pages. I put in a
simple "hello world!" default.aspx which is served correctly. I also
put in my standard default.aspx which hits the database (and verified
that it hit the database when the page was requested). I will note that
whenever *any* page is first requested that I get a general HTTP
exception - but on the second request the page is served as expected.
So, this Web site is online and "mostly" available. The whole problem
is that Application_Start does not fire - which is a big problem
because that's when I load important variables into the Application
state.

FWIW: Toward fixing this I created a new application pool via IIS
Manager and placed the Web application into it (and stopped/restarted
the Web site)... still no dice.

Any ideas for troubleshooting this? I really need Application_Start to
fire.
Thanks!



Nov 19 '05 #5
<< you will need to attach a debugger to the worker process on the server to
find out exactly what is going on>>

Okay, how do I do that? I have VS.NET 2003, am accessing the Web server
across the Internet, and have full administrative access to the Web Server
(which is Windows Server 2003/IIS6, with all current patches/updates).

Since last post, I have a number of new observations but no solution. I
simply need more information *from the server itself* about what's going on.

The Web.config for the app in question includes these:
<customErrors mode="RemoteOnly" defaultRedirect="GenericError.htm" />
(this is the page I keep getting in the client)

In an effort to get more info, I switched from this...
<customErrors mode="RemoteOnly" defaultRedirect="GenericError.htm" />

to this...
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

But kept getting the error page telling me to change the entry in Web.config
to the latter (which I had in fact done). It behaves as if the application
did not restart - because it treated the <customErrors mode> setting as if
it were still <customErrors mode="RemoteOnly"
defaultRedirect="GenericError.htm" />

I also switched Web.config from this:
<compilation
defaultLanguage="c#"
debug="false"
/>
to this:
<compilation
defaultLanguage="c#"
debug="true"
/>

But the site behaves is as if the changes were never made (and yes, I saved
the changes to Web.config).

I had originally created the new Web site via a script -so I manually
created a brand new Web site on the server (and modified the host headers in
IIS so that the old URL would resolve to the new/test Web site) and copied
all of the files into it from the site having the problem this thread is all
about. The new site came up without an exception (and I got the e-mail sent
from Application_Start) - BUT ONLY the very first time I accessed the
application from a client. After the first time, I got the exceptions and
related behavior as described in my prevoius postings. It seems that no
matter what I do, the application will not restart. I have stopped and
restarted the Web Site, it's Application pool, (created a new App pool just
for this app), and even rebooted the server - but still no dice. I have
commented out all of my application_start logic, Session_start logic - but
still no change in behavior. It's as if the Web site simply ignores ANY
changes I make once the exception is encountered for the first time.

I'm pretty confused at this point. How can I get the Web server itself to
tell me more about the exception?

Thanks!

"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
in your application start handler, send an email to yourself
using the system.web.mail functionality. run the app and see if you get an
email.

if you don't get an email, you will need to attach a debugger to the
worker process on the server to find out exactly what is going on.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Thanks Alvin.

A couple of things.
I have a version installed right now that has *all* of the
Application_Start and all of the Session_Start logic (just to ensure that
something wasn't interacting with the new/current Session) commented
out - thereby eliminating the possibility of logic problems, AFAIK.

Since last post I have rebooted the server. Still no dice.

<< Nope, asp.net is not responsible for serving htm files by default.>>
Right... that's why I put an default.html file in. I thought that would
tell me if there was a problem with the Web site (independent of ASP.NET)
or if there was something going on with ASP.NET. So, unless I'm mistaken,
I think I have narrowed it down to "something with ASP.NET or with my
application logic" and not a problem with the Web site, itself or IIS -
because the default.html file was served just fine, but the simple
default.aspx was not.

At this point I'm thinking about killing the site and recreating it from
scratch... but I hate to do that because even if the problem - whatever
it was - goes away, I don't have the opportunity to know what went wrong.
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
>So that tells me it's something about asp.net.
Nope, asp.net is not responsible for serving htm files by default.

Your application start is firing correctly because you can request a
page. Your logic and steps you have taken does not indicate a problem
with your application_start handler. Rather, the problem seems to be
with the code that fires inside the application_start handler. Try
re-writing with some error handling code first to see what gives.
--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
One more observation:
When I have a simple default.htm - that page gets served just fine on
the first request. When I have a simple default.aspx - it chokes. So
that tells me it's something about asp.net.

Still needing ideas here... thanks.
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
>I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows
>Server 2003 production server. 3 of them work fine. I just installed
>the 4th one and it's Application_Start event is not firing.
>
> I have double-checked everything (and rechecked) and I haven't found
> anything that would explain why the Application is not starting.
>
> Here is what I have done so far to troubleshoot this:
>
> In IIS Manager I have ensured that there is a unique Application name
> in the Home Directory tab of the Properties for the Web site in
> question. I have verified that the home directory path is specified
> correctly. All other properties in IIS have identical values to the
> other sites that do work corectly (or have site-specific values that
> make sense). I have stopped and started the Web site via IIS Manager.
> I have verified correct content in Web.config (which is virtually
> identical to the other site's Web.config files). I have saved changes
> to Web.config in an effort to get the application to restart. I have
> recompiled and reinstalled the dll.
>
> I have verified that this particular Web app is in fact online and
> functioning to some extent. This particular Web application connects
> to a database (per settings in Web.config). I have verified that the
> application is, in fact, connecting to the database because I was able
> to log in (and the credentials are verified against a table in the
> database). Furthermore, the Web site will serve up pages. I put in a
> simple "hello world!" default.aspx which is served correctly. I also
> put in my standard default.aspx which hits the database (and verified
> that it hit the database when the page was requested). I will note
> that whenever *any* page is first requested that I get a general HTTP
> exception - but on the second request the page is served as expected.
> So, this Web site is online and "mostly" available. The whole problem
> is that Application_Start does not fire - which is a big problem
> because that's when I load important variables into the Application
> state.
>
> FWIW: Toward fixing this I created a new application pool via IIS
> Manager and placed the Web application into it (and stopped/restarted
> the Web site)... still no dice.
>
> Any ideas for troubleshooting this? I really need Application_Start to
> fire.
>
>
> Thanks!
>



Nov 19 '05 #6
BUT ONLY the very first time I accessed the
application from a client That is expected behavior. The application_start event fires once when the
application starts. If you request another 10 pages, it won't fire because
the application is already started. Don't confuse it with session start.

Use this link for remote debugging
http://support.microsoft.com/?scid=kb;EN-US;833977

debug="true"
simply turns on debugging when compilation of the aspx page occurs.

It's as if the Web site simply ignores ANY changes I make once the exception is encountered for the first time. You never said what the exception was. It would help to post the exact
message.

I'm pretty confused at this point. Me 2.

How can I get the Web server itself to tell me more about the exception?
Add an application_onerror event handler. In this handler, write an email to
yourself passing in the contents of the error - Server.error or
context.error. It will indicate what exactly is going wrong when the
exception handler fires.

Remove the defaultRedirect to the generic error page as well for testing
purposes.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl... << you will need to attach a debugger to the worker process on the server
to find out exactly what is going on>>

Okay, how do I do that? I have VS.NET 2003, am accessing the Web server
across the Internet, and have full administrative access to the Web Server
(which is Windows Server 2003/IIS6, with all current patches/updates).

Since last post, I have a number of new observations but no solution. I
simply need more information *from the server itself* about what's going
on.

The Web.config for the app in question includes these:
<customErrors mode="RemoteOnly" defaultRedirect="GenericError.htm" />
(this is the page I keep getting in the client)

In an effort to get more info, I switched from this...
<customErrors mode="RemoteOnly" defaultRedirect="GenericError.htm" />

to this...
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

But kept getting the error page telling me to change the entry in
Web.config to the latter (which I had in fact done). It behaves as if the
application did not restart - because it treated the <customErrors mode>
setting as if it were still <customErrors mode="RemoteOnly"
defaultRedirect="GenericError.htm" />

I also switched Web.config from this:
<compilation
defaultLanguage="c#"
debug="false"
/>
to this:
<compilation
defaultLanguage="c#"
debug="true"
/>

But the site behaves is as if the changes were never made (and yes, I
saved the changes to Web.config).

I had originally created the new Web site via a script -so I manually
created a brand new Web site on the server (and modified the host headers
in IIS so that the old URL would resolve to the new/test Web site) and
copied all of the files into it from the site having the problem this
thread is all about. The new site came up without an exception (and I got
the e-mail sent from Application_Start) - BUT ONLY the very first time I
accessed the application from a client. After the first time, I got the
exceptions and related behavior as described in my prevoius postings. It
seems that no matter what I do, the application will not restart. I have
stopped and restarted the Web Site, it's Application pool, (created a new
App pool just for this app), and even rebooted the server - but still no
dice. I have commented out all of my application_start logic,
Session_start logic - but still no change in behavior. It's as if the Web
site simply ignores ANY changes I make once the exception is encountered
for the first time.

I'm pretty confused at this point. How can I get the Web server itself to
tell me more about the exception?

Thanks!

"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
in your application start handler, send an email to yourself
using the system.web.mail functionality. run the app and see if you get
an email.

if you don't get an email, you will need to attach a debugger to the
worker process on the server to find out exactly what is going on.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Thanks Alvin.

A couple of things.
I have a version installed right now that has *all* of the
Application_Start and all of the Session_Start logic (just to ensure
that something wasn't interacting with the new/current Session)
commented out - thereby eliminating the possibility of logic problems,
AFAIK.

Since last post I have rebooted the server. Still no dice.

<< Nope, asp.net is not responsible for serving htm files by default.>>
Right... that's why I put an default.html file in. I thought that would
tell me if there was a problem with the Web site (independent of
ASP.NET) or if there was something going on with ASP.NET. So, unless I'm
mistaken, I think I have narrowed it down to "something with ASP.NET or
with my application logic" and not a problem with the Web site, itself
or IIS - because the default.html file was served just fine, but the
simple default.aspx was not.

At this point I'm thinking about killing the site and recreating it from
scratch... but I hate to do that because even if the problem - whatever
it was - goes away, I don't have the opportunity to know what went
wrong.
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
>So that tells me it's something about asp.net.
Nope, asp.net is not responsible for serving htm files by default.

Your application start is firing correctly because you can request a
page. Your logic and steps you have taken does not indicate a problem
with your application_start handler. Rather, the problem seems to be
with the code that fires inside the application_start handler. Try
re-writing with some error handling code first to see what gives.
--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> One more observation:
> When I have a simple default.htm - that page gets served just fine on
> the first request. When I have a simple default.aspx - it chokes. So
> that tells me it's something about asp.net.
>
> Still needing ideas here... thanks.
>
>
> "Gordon Smith" <GS@NoSpam.net> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>I have four (4) ASP.NET Web applications/Web sites on a IIS/6 -
>>Windows Server 2003 production server. 3 of them work fine. I just
>>installed the 4th one and it's Application_Start event is not firing.
>>
>> I have double-checked everything (and rechecked) and I haven't found
>> anything that would explain why the Application is not starting.
>>
>> Here is what I have done so far to troubleshoot this:
>>
>> In IIS Manager I have ensured that there is a unique Application name
>> in the Home Directory tab of the Properties for the Web site in
>> question. I have verified that the home directory path is specified
>> correctly. All other properties in IIS have identical values to the
>> other sites that do work corectly (or have site-specific values that
>> make sense). I have stopped and started the Web site via IIS Manager.
>> I have verified correct content in Web.config (which is virtually
>> identical to the other site's Web.config files). I have saved changes
>> to Web.config in an effort to get the application to restart. I have
>> recompiled and reinstalled the dll.
>>
>> I have verified that this particular Web app is in fact online and
>> functioning to some extent. This particular Web application connects
>> to a database (per settings in Web.config). I have verified that the
>> application is, in fact, connecting to the database because I was
>> able to log in (and the credentials are verified against a table in
>> the database). Furthermore, the Web site will serve up pages. I put
>> in a simple "hello world!" default.aspx which is served correctly. I
>> also put in my standard default.aspx which hits the database (and
>> verified that it hit the database when the page was requested). I
>> will note that whenever *any* page is first requested that I get a
>> general HTTP exception - but on the second request the page is served
>> as expected. So, this Web site is online and "mostly" available. The
>> whole problem is that Application_Start does not fire - which is a
>> big problem because that's when I load important variables into the
>> Application state.
>>
>> FWIW: Toward fixing this I created a new application pool via IIS
>> Manager and placed the Web application into it (and stopped/restarted
>> the Web site)... still no dice.
>>
>> Any ideas for troubleshooting this? I really need Application_Start
>> to fire.
>>
>>
>> Thanks!
>>
>
>



Nov 19 '05 #7
Problem Solved!
When things get really strange it often has to do with security (I should
have known). It turns out my application's dll had no security permissions
for the ASP.NET and NETWORK SERVICE accounts. I just added those and
everything worked as expected. The reason why I couldn't get specific
exception information is because in the process of troubleshooting this I
screwed up Web.config (accedentially got two sets of <configuration> tags in
there - oh the curse of mindless cutting and pasting). So, the whole thing
choked when Web.config could not be parsed. That's why I wasn't getting
EITHER Application_Start to fire NOR my custom exception handler (in the
HTTP Module) that sends the e-mail to fire. Without being able to parse
Web.config, the whole thing was dead before having a chance to come to life
enough to fire the application's OnError event handler.

Thank you so much for your time on this thread.
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
BUT ONLY the very first time I accessed the
application from a client

That is expected behavior. The application_start event fires once when
the application starts. If you request another 10 pages, it won't fire
because the application is already started. Don't confuse it with session
start.

Use this link for remote debugging
http://support.microsoft.com/?scid=kb;EN-US;833977

debug="true"
simply turns on debugging when compilation of the aspx page occurs.

It's as if the Web site simply ignores ANY
changes I make once the exception is encountered for the first time.

You never said what the exception was. It would help to post the exact
message.

I'm pretty confused at this point.

Me 2.

How can I get the Web server itself to
tell me more about the exception?


Add an application_onerror event handler. In this handler, write an email
to yourself passing in the contents of the error - Server.error or
context.error. It will indicate what exactly is going wrong when the
exception handler fires.

Remove the defaultRedirect to the generic error page as well for testing
purposes.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...
<< you will need to attach a debugger to the worker process on the server
to find out exactly what is going on>>

Okay, how do I do that? I have VS.NET 2003, am accessing the Web server
across the Internet, and have full administrative access to the Web
Server (which is Windows Server 2003/IIS6, with all current
patches/updates).

Since last post, I have a number of new observations but no solution. I
simply need more information *from the server itself* about what's going
on.

The Web.config for the app in question includes these:
<customErrors mode="RemoteOnly" defaultRedirect="GenericError.htm" />
(this is the page I keep getting in the client)

In an effort to get more info, I switched from this...
<customErrors mode="RemoteOnly" defaultRedirect="GenericError.htm" />

to this...
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

But kept getting the error page telling me to change the entry in
Web.config to the latter (which I had in fact done). It behaves as if the
application did not restart - because it treated the <customErrors mode>
setting as if it were still <customErrors mode="RemoteOnly"
defaultRedirect="GenericError.htm" />

I also switched Web.config from this:
<compilation
defaultLanguage="c#"
debug="false"
/>
to this:
<compilation
defaultLanguage="c#"
debug="true"
/>

But the site behaves is as if the changes were never made (and yes, I
saved the changes to Web.config).

I had originally created the new Web site via a script -so I manually
created a brand new Web site on the server (and modified the host headers
in IIS so that the old URL would resolve to the new/test Web site) and
copied all of the files into it from the site having the problem this
thread is all about. The new site came up without an exception (and I
got the e-mail sent from Application_Start) - BUT ONLY the very first
time I accessed the application from a client. After the first time, I
got the exceptions and related behavior as described in my prevoius
postings. It seems that no matter what I do, the application will not
restart. I have stopped and restarted the Web Site, it's Application
pool, (created a new App pool just for this app), and even rebooted the
server - but still no dice. I have commented out all of my
application_start logic, Session_start logic - but still no change in
behavior. It's as if the Web site simply ignores ANY changes I make once
the exception is encountered for the first time.

I'm pretty confused at this point. How can I get the Web server itself to
tell me more about the exception?

Thanks!

"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
in your application start handler, send an email to yourself
using the system.web.mail functionality. run the app and see if you get
an email.

if you don't get an email, you will need to attach a debugger to the
worker process on the server to find out exactly what is going on.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Gordon Smith" <GS@NoSpam.net> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Thanks Alvin.

A couple of things.
I have a version installed right now that has *all* of the
Application_Start and all of the Session_Start logic (just to ensure
that something wasn't interacting with the new/current Session)
commented out - thereby eliminating the possibility of logic problems,
AFAIK.

Since last post I have rebooted the server. Still no dice.

<< Nope, asp.net is not responsible for serving htm files by default.>>
Right... that's why I put an default.html file in. I thought that would
tell me if there was a problem with the Web site (independent of
ASP.NET) or if there was something going on with ASP.NET. So, unless
I'm mistaken, I think I have narrowed it down to "something with
ASP.NET or with my application logic" and not a problem with the Web
site, itself or IIS - because the default.html file was served just
fine, but the simple default.aspx was not.

At this point I'm thinking about killing the site and recreating it
from scratch... but I hate to do that because even if the problem -
whatever it was - goes away, I don't have the opportunity to know what
went wrong.
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
> >So that tells me it's something about asp.net.
> Nope, asp.net is not responsible for serving htm files by default.
>
> Your application start is firing correctly because you can request a
> page. Your logic and steps you have taken does not indicate a problem
> with your application_start handler. Rather, the problem seems to be
> with the code that fires inside the application_start handler. Try
> re-writing with some error handling code first to see what gives.
>
>
> --
> Regards
> Alvin Bruney
> [Shameless Author Plug]
> The Microsoft Office Web Components Black Book with .NET
> available at www.lulu.com/owc
> --------------------------------------------------
>
>
> "Gordon Smith" <GS@NoSpam.net> wrote in message
> news:%2****************@TK2MSFTNGP10.phx.gbl...
>> One more observation:
>> When I have a simple default.htm - that page gets served just fine on
>> the first request. When I have a simple default.aspx - it chokes. So
>> that tells me it's something about asp.net.
>>
>> Still needing ideas here... thanks.
>>
>>
>> "Gordon Smith" <GS@NoSpam.net> wrote in message
>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>>I have four (4) ASP.NET Web applications/Web sites on a IIS/6 -
>>>Windows Server 2003 production server. 3 of them work fine. I just
>>>installed the 4th one and it's Application_Start event is not firing.
>>>
>>> I have double-checked everything (and rechecked) and I haven't found
>>> anything that would explain why the Application is not starting.
>>>
>>> Here is what I have done so far to troubleshoot this:
>>>
>>> In IIS Manager I have ensured that there is a unique Application
>>> name in the Home Directory tab of the Properties for the Web site in
>>> question. I have verified that the home directory path is specified
>>> correctly. All other properties in IIS have identical values to the
>>> other sites that do work corectly (or have site-specific values that
>>> make sense). I have stopped and started the Web site via IIS
>>> Manager. I have verified correct content in Web.config (which is
>>> virtually identical to the other site's Web.config files). I have
>>> saved changes to Web.config in an effort to get the application to
>>> restart. I have recompiled and reinstalled the dll.
>>>
>>> I have verified that this particular Web app is in fact online and
>>> functioning to some extent. This particular Web application connects
>>> to a database (per settings in Web.config). I have verified that the
>>> application is, in fact, connecting to the database because I was
>>> able to log in (and the credentials are verified against a table in
>>> the database). Furthermore, the Web site will serve up pages. I put
>>> in a simple "hello world!" default.aspx which is served correctly. I
>>> also put in my standard default.aspx which hits the database (and
>>> verified that it hit the database when the page was requested). I
>>> will note that whenever *any* page is first requested that I get a
>>> general HTTP exception - but on the second request the page is
>>> served as expected. So, this Web site is online and "mostly"
>>> available. The whole problem is that Application_Start does not
>>> fire - which is a big problem because that's when I load important
>>> variables into the Application state.
>>>
>>> FWIW: Toward fixing this I created a new application pool via IIS
>>> Manager and placed the Web application into it (and
>>> stopped/restarted the Web site)... still no dice.
>>>
>>> Any ideas for troubleshooting this? I really need Application_Start
>>> to fire.
>>>
>>>
>>> Thanks!
>>>
>>
>>
>
>



Nov 19 '05 #8

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

Similar topics

3
7779
by: alexB | last post by:
On my ASP.NET application, restarting the application through IIS doesn't always fire the Application_Start() event. Is there a trick to this? Restarting IIS is not an option since there are...
4
7055
by: Halcyon Woodward | last post by:
I have an odd problem... We have a small development team (three coders) working on the same project (a C# web application). Each coder has a unique 'sandbox' site on a shared Windows 2003...
4
11932
by: Max | last post by:
I've noticed some procedures don't run in the global.asax when you'd expect them to. I've rebuilt and set break points, but Application_Start just isn't firing today. Is there some configuration...
3
1398
by: msnews.microsoft.com | last post by:
Hi What can you do with the errors occuring in global.asax in Application_Start (or Init) ? What is the best practice here ? What's the elegant solution in this case ? For now (I'm learning)...
0
2090
by: SeanGallavan | last post by:
Our Environment: Two network load balanced (using Microsoft NLB software) webservers with session maintained in a SQL Server database. NLB is configured with no affinity settings and two...
7
2254
by: Christian Blackburn | last post by:
Hi Gang, Let me start by saying I'm using Visual Web Developer 2005 and ASP.net 2.0. Is there something I have to do to get my Global.asax fire when my application loads. If I set a breakpoint...
1
2967
by: Steve Ricketts | last post by:
I have a web service written in VB 2003 .Net that I've put on a number of different servers an OS's, 2003 and 2000. Application_Start sets up a number of variables used by the various functions in...
18
2131
by: Joey | last post by:
asp.net 2/C# I have noticed that during periods of inactivity on my website, the Application_Start event is firing about every 40-45 minutes. Is this normal? Shouldn't the app start once and...
4
6133
by: gamesforums | last post by:
Hi! I have some code within the Application_Start event in Global.asax that runs a sqlscript against my sql server to check the databas version. My problem is that sometimes the...
0
7212
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
7098
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
7296
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,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
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...
1
5026
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
4696
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
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.