Most articles mention:
- Ensure that Microsoft.Owin.Host.SystemWeb.dll is in the bin folder of the web application
- Run app pool in V4.0 integrated mode
- Add runAllManagedModulesForAllRequests to your Web.config:
123<
system.webServer
>
<
modules
runAllManagedModulesForAllRequests
=
"true"
/>
</
system.webServer
>
1 | app.UseStageMarker(PipelineStage.MapHandler); |
Some details, you can find in OWIN Middleware in the IIS integrated pipeline. The article describes how the pipelines in OWIN and ASP.NET relate. Very helpful for me was the tracing of the current pipeline stage.
My code was something like
1 2 3 4 5 6 | public void Configuration(IAppBuilder app) { app.UseStaticFiles(); app.MapSignalR(); app.UseWebApi(); } |
- UseStaticFiles: AuthorizeRequest
- MapSignalR: AuthorizeRequest
- UseWebApi: missing
- UseStaticFiles: AuthorizeRequest
- MapSignalR: AuthorizeRequest
- UseWebApi: PreExecuteRequestHandler
My first suspicion was, that MapSignalR did prevent the further processing. But this was completely wrong. Due to MapSignalR at least everything before (including SignalR) worked, since MapSignalR is setting the stage marker PostAuthorize.
Unfortunately everything later than MapHandler is not executed on IIS7. Therefore I had to add the appropriate call at the end of my method:
1 2 3 4 5 6 7 | public void Configuration(IAppBuilder app) { app.UseStaticFiles(); app.MapSignalR(); app.UseWebApi(); app.UseStageMarker(PipelineStage.MapHandler); } |
- UseStaticFiles: AuthorizeRequest
- MapSignalR: AuthorizeRequest
- UseWebApi: MapRequestHandler