C# – This operation requires IIS integrated pipeline mode. AntiForgeryToken

ciis-7net

I'm running IIS7, .NET 4.5 and have a site that is MVC2.

I'm getting the error "This operation requires IIS integrated pipeline mode." when I navigate to a page (an aspx View) with a form on it with an AntiForgeryToken on it.

<%=Html.AntiForgeryToken() %>

I've searched around and seen the AddHeaders solution that fixes this error for other people (who are running IIS6) but I can't see how that would be similar.

The reason I mention the AntiForgeryToken, is because if I take that line out, the page works!

EDIT:
I've tried reinstalling .NET 4.5 – didn't help

EDIT: My AppPool is definitely set to "Integrated" Managed Pipeline Mode (ApplicationPoolIdentity). It's the only app in this app pool.

Best Answer

Run the application in IIS Express. This solved the same issue to me. Just right click your project and choose "properties" and click "Web" tab, there under servers click "use localIIS web server and click "USE IIS express"