Web Debug

Fix broken web applications, from servers to clients.

How to add managed module build on .NET 4.0 in IIS7

Basic steps to add managed module to IIS,

1. Write the code you want to run on every request, as a .net 3.5 Class Library.
2. Compile it as a strong-named assembly.
3. Install the assembly in the GAC.
4. In IIS7 manager, select the server name in connections, click Modules, click "Add managed module" in actions.
5. Write a name for the module and choose your newly installed assembly in the type dropdown.
6. Make sure the site uses an application pool running in integrated mode.

 

One question remains though!

There are now two GAC's, Microsoft.NET for .net 4.0, and Windows GAC for pre .net 4.0. Because I created my assembly in .net 3.5, it was installed in Windows GAC, and therefore it was avalable in the type dropdown in IIS manager.

When I created my assembly in .net 4.0, it was installed in the Microsoft.NET GAC, and as a result, it was NOT avalable in the type dropdown in IIS manager.

After working with this for a bit, I managed to make it work. What I had to do was:

1. Create the .net 4.0 Class Library, and compile it as a strong named assembly

2. Install it in the .net 4.0 GAC by using the gacutil, located in Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools

(Or make Visual Studio compile, sign and install the assembly automatically)

3. Add this line under in applicationHost.config: (it has to be done manually, it can't be done in the manager)


http://stackoverflow.com/questions/9210550/module-registered-in-iis7-doenst-work

Fork me on GitHub