Sergej Popov
Sergej Popov

Reputation: 3021

Global.asax Application_BeginRequest not firing unless physical file exists - 404

I use URL rewriting (HttpContext.Current.RewritePath(...)) inside Global.asax so the physical files mostly don't exist. Everything was working fine until I had to remove site from IIS (8.5) and add it again.

And now I get 404 not found for every request. Example http://localhost/site/article123 And Global.asax Application_BeginRequest event not even firing.

If I however will add empty default.aspx file in folder /site/article123 everything starts to work fine with URL being correctly rewritten.

Files have not changed, so it's ought to be the problem with IIS configuration.

I do have following inside web.config:
<modules runAllManagedModulesForAllRequests="true">

Project in IIS is set as an Application with Application Pool .NET v2.0 Classic

Edit:
Same story in IIS 8.0

Upvotes: 4

Views: 7383

Answers (2)

Sergej Popov
Sergej Popov

Reputation: 3021

The problem was in Managed Pipeline Mode set as classic. Switching from classic to integrated by changing Application pool from .NET v2.0 Classic to .NET v2.0 sorted the problem.

As I understood this: in classic mode IIS is managing requests, while in intergated mode incoming IIS requests map to the ASP.NET engine.

More on pipeline modes: What is the difference between 'classic' and 'integrated' pipeline mode in IIS7?

Upvotes: 8

GKG4
GKG4

Reputation: 491

You need to have ReWrite Module installed under IIS 8.5

Use Web Installer Platform to install it.

Upvotes: 0

Related Questions