【问题标题】:Owin Middleware results in 404 on serverOwin 中间件在服务器上导致 404
【发布时间】:2013-11-21 18:20:17
【问题描述】:

我有一个 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

【问题讨论】:

标签: c# .net iis-7 owin


【解决方案1】:

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

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

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

【讨论】:

  • 两者都正确,将检查链接。它在我的 win7 IIS7 上使用默认设置开箱即用(我创建了一个指向发布文件夹的应用程序),这很奇怪
  • 我已验证 Owin 启动正在触发,所以我的中间件已注册但仍然无法正常工作。
  • 这个问题有什么解决办法吗?
  • 我的 lib 的用户报告说他遇到了同样的问题,这有助于 app.UseStageMarker(PipelineStage.MapHandler);我会调查原因
  • 天哪,你也拯救了我的一天
猜你喜欢
  • 2014-12-21
  • 2021-02-12
  • 1970-01-01
  • 2020-12-29
  • 1970-01-01
  • 2014-01-03
  • 2014-01-04
  • 1970-01-01
  • 2015-01-01
相关资源
最近更新 更多