Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Owin Middleware results in 404 on server

Tags:

c#

.net

iis-7

owin

I have a owin middle ware it works on my IIS7 on my dev machine (win7). But when deployed to a 2008 server the page returns 404

I hook up the middleware like this

public static class AppBuilderExtensions
{
    public static void InitTemplateStore(this IAppBuilder app, string templatePath, string fileMask)
    {
        TemplateStoreMiddleware.Init(templatePath, fileMask);
        app.Map("/templates", subApp => subApp.Use<TemplateStoreMiddleware>());
    }
}

The code that uses the middleware can be found here

https://github.com/AndersMalmgren/Knockout.Bootstrap.Demo

The site is hosted as an virtual app under the default web site on IIS

edit: Do I need to add any roles out of the default ones?

IIS is tring to use the StaticFile handler which offcourse is wrong, why is this happening?

Module  IIS Web Core
Notification    MapRequestHandler
Handler StaticFile
Error Code  0x80070002
Requested URL   http://localhost:80/knockout.bootstrap.demo/templates?root=shared
Physical Path   C:\inetpub\knockout.bootstrap.demo\templates
Logon Method    Anonymous
Logon User  Anonymous
like image 957
Anders Avatar asked Nov 21 '13 18:11

Anders


1 Answers

A few common reasons for a OWIN middleware not working as expected in IIS integrated pipeline.

  1. Check if you have Microsoft.Owin.Host.SystemWeb nuget package installed in your project and its in the bin folder of your app.
  2. Is your app pool a v4.0 Integrated mode one (most probably this one?)

This article can be of help. Also this question I believe is similar to yours.

like image 144
Praburaj Avatar answered Oct 02 '22 10:10

Praburaj