c# - Owin 中间件在服务器上导致 404

标签 c# .net iis-7 owin

我有一个 owin 中间件,它可以在我的开发机器 (win7) 上的 IIS7 上运行。 但是当部署到 2008 服务器时,页面返回 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>());
    }
}

可以在这里找到使用中间件的代码

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

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

编辑:我是否需要添加默认角色之外的任何角色?

IIS 正在尝试使用 StaticFile 处理程序,但这是错误的,为什么会这样?

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

最佳答案

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

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

This文章可以提供帮助。还有 this我认为问题与您的相似。

关于c# - Owin 中间件在服务器上导致 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20128919/

相关文章:

c# - 清除公交车起点或终点处的队列

c# - 使用两个具有相同名称和相同命名空间的 DLL

c# - 程序卸载时调用函数/Api

c# - 是否有与 .NET Core 的 IControllerActivator 等效的 .NET Framework?

windows - IIS 自签名证书问题 - 'The Parameter is incorrect'

c# - 使用 ASP.NET 代码中的凭据从网络位置读取文件

c# - Code First ASP.NET MVC 应用程序,未调用种子方法

c# - EF过滤/搜索多个词

c# - "first time"a DbContext 到底是什么时候访问数据库的?

asp.net - DefaultAppPool 是否在 IIS 上以特殊提升的权限运行?