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:
<system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer>
app.UseStageMarker(PipelineStage.MapHandler);to the end of my Startup.Configuration() method. Really important is “the end”.
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
public void Configuration(IAppBuilder app) { app.UseStaticFiles(); app.MapSignalR(); app.UseWebApi(); }With the tracing, I saw the following the following stages on IIS7:
- 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:
public void Configuration(IAppBuilder app) { app.UseStaticFiles(); app.MapSignalR(); app.UseWebApi(); app.UseStageMarker(PipelineStage.MapHandler); }Now everything is working latest in stage MapRequestHandler, in my case:
- UseStaticFiles: AuthorizeRequest
- MapSignalR: AuthorizeRequest
- UseWebApi: MapRequestHandler
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.