Owin 中间件在服务器上导致 404 [英] Owin Middleware results in 404 on server

查看:38
本文介绍了Owin 中间件在服务器上导致 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 owin 中间件,它可以在我的开发机器 (win7) 上的 IIS7 上运行.但是当部署到 2008 服务器时,页面返回 404

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

我像这样连接中间件

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

网站作为虚拟应用托管在 IIS 上的默认网站下

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 正在尝试使用错误的 StaticFile 处理程序,为什么会发生这种情况?

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:inetpubknockout.bootstrap.demo	emplates
Logon Method    Anonymous
Logon User  Anonymous

推荐答案

OWIN 中间件在 IIS 集成管道中无法按预期工作的几个常见原因.

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

  1. 检查您的项目中是否安装了 Microsoft.Owin.Host.SystemWeb nuget 包及其应用的 bin 文件夹中.
  2. 您的应用程序池是 v4.0 集成模式之一吗(很可能是这个?)

这个 文章可以提供帮助.另外 this 问题我相信与您的问题相似.

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

这篇关于Owin 中间件在服务器上导致 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆