【问题标题】:Plugging MVC5 into an OWIN/Katana Application将 MVC5 插入 OWIN/Katana 应用程序
【发布时间】:2018-06-28 09:59:57
【问题描述】:

我在文章中读到 web api 2 可以很容易地集成到 Owin 管道中。

//欧文代码:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        var webApiConfiguration = ConfigureWebApi();

        // Use the extension method provided by the WebApi.Owin library:
        app.UseWebApi(webApiConfiguration);
    }


    private HttpConfiguration ConfigureWebApi()
    {
        var config = new HttpConfiguration();
        config.Routes.MapHttpRoute(
            "DefaultApi",
            "api/{controller}/{id}",
            new { id = RouteParameter.Optional });
        return config;
    }
}

我已经阅读了很多关于OWIN规范的文章,但我还是有点困惑,请帮助我澄清问题:

问:

  1. 是否可以将 asp.net mvc5 集成到 Owin 管道中 和 Web Api 一样吗?
  2. 或者由于与 system.web 组件的紧密绑定而无法实现?

【问题讨论】:

  • 是的,有可能。
  • 感谢您的关注!请提供示例或资源链接

标签: c# asp.net asp.net-mvc asp.net-web-api owin


【解决方案1】:

不,不幸的是,无法在 Owin/Katana 或自托管上运行 ASP.Net MVC 5。它需要 IIS。

但是 ASP.Net Core 完全运行在 Owin 和 selfHost 上。

【讨论】:

  • 我得出了同样的结论,我认为是因为asp.net mvc5与system.web assymby紧密绑定,这是.net框架的一个组成部分
猜你喜欢
  • 2015-01-10
  • 1970-01-01
  • 1970-01-01
  • 2023-04-06
  • 1970-01-01
  • 2016-02-02
  • 2017-05-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多