Error
This operation requires IIS version 7.5 or higher running in integrated pipeline mode.
This comes up anytime I try to access my WebApi page. The [HttpPost] decorated method is never hit. I understand Cassini does not allow integrated mode. However, I'm using code that's very similar to other projects in our code base that also use Cassini and we do not get this error.
I don't know what I'm using that requires integrated pipeline mode. My guess is something in global.asax is causing the issue. I'm using SimpleInjector.
I have boiled my global.asax down to this:
public class WebApiApplication : SimpleInjectorApiApplication<GenericExceptionPolicy>
{
protected override Assembly GetVersionAssembly()
{
return Assembly.GetExecutingAssembly();
}
protected override void RegisterServices()
{
base.RegisterServices();
Container.Register<IEntityCache, EntityCache>();
Container.Register<ICacheProvider, HttpCacheProvider>();
Container.Verify();
}
protected override void OnApplicationStarted()
{
base.OnApplicationStarted();
WebApiConfig.Register(RouteTable.Routes);
}
}
My Controller:
public class GenericController : ApiController
{
[HttpPost]
public HttpResponseMessage Get( /*PocoObjectName item*/)
{
throw new NotImplementedException();
}
}
And the web.config contains this relevant part:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
All this code exists in other projects and works as it is..so I'm at a total loss for what the problem is here. The issue only occurs in Cassini (IIS Express runs the code fine). Other projects are using Cassini without this error.
I updated
Microsoft.AspNet.WebApi.WebHost. In the package manager console for NuGet I went from:Install-Package Microsoft.AspNet.WebApi.WebHost -Version 5.1.0.0to
Install-Package Microsoft.AspNet.WebApi.WebHost -Version 5.1.2.0And the problem went away.