Mod_mono ignoring global.asax and httpmodules

604 Views Asked by At

I am trying to move a website from IIS to a mod_mono & apache2 combo and got most of the site running already. However, I need some way of setting up event handlers on unhandled exceptions for logging as well as a lot of url rewriting that I like to do in httpmodules.

The code works fine on IIS. Target framework is .NET 4.0 and code is mostly VB.NET. But on my Linux setup it seems like none of the methods are ever called. Not Init in my httpmodules or any of the handlers that should have been registered through this.
Methods in Global.asax seem to be ignored as well.

For the record, I'm running ubuntu Saucy Salamander. I compile my website into a deploy package with visual studios publish website feature, and apache says:
Version information: Mono Runtime Version: 2.10.8.1 (Debian 2.10.8.1-5ubuntu2); ASP.NET Version: 4.0.30319.1

Also, for web.config I have httpmodules added under both system.web and system.webServer as such:

  <system.web>
    ...
    <httpModules>
      <add name="SiteModule" type="Sitemodule"/>
      ...
    </httpModules>
  </system.web>

  <system.webServer>
    <modules>
      <add name="SiteModule" type="SiteModule"/>
      ...
    </modules>
    ...
  </system.webServer>

So, what could be the reason for this behavior? Is the server wrongly configured or does the website code need some changes to fit into the new environment?

1

There are 1 best solutions below

0
On

Did you find an answer to your question?

I just tried something similar... I deployed the Global.asax file to the web root and restarted the apache service and it just worked. I manually copy files to the web server, instead of using VS deploy option.

FWIW: Ubuntu 12.04.5 LTS, with mono 3.6.0, .NET 4.0, C#