运行不同的框架并排侧OWIN [英] Run different frameworks side-by-side with OWIN

查看:218
本文介绍了运行不同的框架并排侧OWIN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的IM $ P $的Owin很大的好处之一pssion是,它可以很容易地运行不同的Web框架并排侧没有IIS的的IHttpHandler 。 (这将是巨大的用于分配功能垂直切片作为的NuGet特征。)

My impression of one of the big benefits of Owin is that it makes it easy to run different web frameworks side-by-side without IIS's IHttpHandler. (This would be huge for distributing vertical functionality slices as nuget features.)

不过每个教程和文章中,我发现像自我主机和一个单一的框架谈判。这不是我感兴趣的,我感兴趣的运行MVC,南希,网络API,甚至在同一个应用web表单。

However every tutorial and article I find talks of things like self-host and a single framework. This is not what I'm interested in, I'm interested in running mvc, nancy, web api, maybe even webforms in the same application.

难道我错了OWIN启用此?说我想

Am I wrong about OWIN enabling this? Say I want

  • 的mvc处理大多数请求
  • 在Web表单处理其中有一个版本的请求=传统报头
  • 南希来处理请求/南希/...

如何配置我的启动类来实现这一点?

How would I configure my Startup class to enable this?

推荐答案

虽然使用情况听起来有点荒唐,你是绝对正确的OWIN实现这一点。你可以撰写你的各种疯狂的方式流水线。

Although the use case sounds a bit absurd, you're absolutely right that OWIN enables this. You can compose your pipeline in all kinds of crazy ways.

一个典型的直管道将是这个样子:

A typical "straight" pipeline would look something like this:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseWebApi(new MyHttpConfiguration());
        app.MapSignalR();
        app.UseNancy();
    }
}

这将如下工作(给你主持的的http://本地主机/

This will work as follows (given you're hosting on http://localhost/)

  • 的WebAPI - 的http://本地主机/ API / * (默认路由)
  • SignalR - 的http://本地主机/ signalr (默认路由)
  • 南希 - 的http://本地主机/ * (将处理一切)
  • WebAPI - http://localhost/api/* (default routing)
  • SignalR - http://localhost/signalr (default route)
  • Nancy - http://localhost/* (will handle everything else)

您还可以创建在您的管道分支:

You can also create branches in your pipeline:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseWebApi(new MyHttpConfiguration());

        app.Map("/newSite", site =>
        {
            site.MapSignalR();
            site.UseNancy();
        });
    }
}

这将如下工作(给你主持的的http://本地主机/

This will work as follows (given you're hosting on http://localhost/)

  • 的WebAPI - 的http://本地主机/ API / * (默认路由)
  • SignalR - 的http://本地主机/ newSite / signalr (默认路由)
  • 南希 - 的http://本地主机/ newSite / * (将处理一切)
  • WebAPI - http://localhost/api/* (default routing)
  • SignalR - http://localhost/newSite/signalr (default route)
  • Nancy - http://localhost/newSite/* (will handle everything else)

这篇关于运行不同的框架并排侧OWIN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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