c# - IIS: Unexpected behavior in case of unhandled exception in Application_Start -
i'm using windows 7, iis 7.5.7600.16385 , .net 4.6.1 installed , have mvc application.
some days ago had strange behavior @ our application. unfortunately service called inside application_start not available , unhandled exception thrown inside. expected behavior application_start() called again next request or the next request starting directly application_beginrequest() mentioned in what happens if unhandled exception thrown in application_start?.
unfortunately following result:
in case of exception inside application_start() error 500 @ first request. that's ok.
after other requests returning exception thrown @ first request. verified throwing exception timestamp inside @ local environment. each response contains exception timestamp first request , http answer still 500. has no dependency url called. @ our code no breakpoint hit iis log show requests. seems answer cached somewhere.
personally behavior because application doesn't respond requests undefined initialization status.
and yes know calling other service resources inside application_start() not best idea , remove next time :)
my questions:
is possible configure behavior in case of exception thrown @ application_start()?
maybe know when behavior changed or exists long time?
well analyzed scenario , search through many sites, coould not find info it. however, managed observe behavior:
- when unhandled error thrown inside application_start iis returns error page , web app starts shut down.
- during shutdown (in case 10 sec.) new request handled iis , response same in first request. if think logical, because iis knows website shutting down obvious last error cause it.
- after time application raises application_end event let know shutting down complete. after event next request website raise application_start again , new response generated.
i don't think can alter behavior, because application need time restart.
Comments
Post a Comment