HttpModule Init method invoked on every request

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a strange situation that I cannot seem to get a grasp on. I have an
HttpModule defined in my web.config and the Init (from IHttpModule) method is
being invoked by ASP.NET for every request.

Anyone got any suggestions ?

ASP.NET 2.0

Cheers...

Rob
 
Hi Rob,

Is it possible that your application is being restarted each request? You
can debug or add log in Application_Start event of Global.asax and verify
this. Note if during the request processing, if any of your code creates a
new subdirectory or changes bin subdirectory, the web application will be
restarted.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Walter,

The Application_Start request is NOT being invoked every time. There is
also no directory creation. Interestingly enough if I swap from IIS6 to IIS5
mode, the issue disappears.
 
Hi Rob,

Thanks for your updated information about the IIS isolation mode.

When you configure IIS 6.0 to run in IIS 5.0 isolation mode, ASP.NET runs
in its own process model, Aspnet_wp.exe, and uses its own configuration
settings. These settings are stored in the computer-wide Machine.config
configuration file.

When running on IIS 6.0 in worker process isolation mode, ASP.NET uses the
IIS 6.0 process model settings.

#Mapping ASP.NET Process Model Settings to IIS 6.0 Application Pool Settings
http://msdn2.microsoft.com/en-us/library/aa719566(VS.71).aspx


For the IHttpModule.Init issue, I've also found some updated information:

#INFO: Application Instances, Application Events, and Application State in
ASP.NET
http://support.microsoft.com/kb/312607
<quote>
The ASP.NET runtime creates as many instances of application classes as
needed to process requests simultaneously. For most applications, this
number is limited to the number of threads and remains in the range of 1
through 100, depending on the hardware, server load, configuration, and so
on. Many requests reuse application instances, and a free list of
application instances is kept during periods of reduced load. Application
instances are used in a thread-safe manner, that is, one request at a time.
</quote>


Sorry for not clarifying this fact in my last reply.

Based on these information, my guess is that your IIS 6.0 application pool
settings are causing each request using a new HttpApplication instance.




Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Walter,

All the supplied information seems to relate to .NET 1.1.

We recently ported our web application from 1.1 to 2.0/3.0 and this problem
only seems to occur under .NET 2.0.
 
Hi Rob,

The information should still apply to ASP.NET 2.0.

Could you please create a small but complete reproducible project so that I
can reproduce the issue on my side and find the root cause or explain the
behavior? I've done some searching in our internal database and didn't find
similar issues, therefore your information is quite important for us.
Thanks for your effort.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top