加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – OWIN无法使用webapp.start隔离运行多个应用程序

发布时间:2020-12-15 05:41:39 所属栏目:百科 来源:网络整理
导读:当我尝试在不同的URL上启动两个应用程序时,我遇到了属性路由中间件的问题.如果我在单独的应用程序中有两个类似的路由,但使用不同的http方法web.api似乎只找到其中??一种方法. Microsoft.Owin.Hosting.WebApp.StartAdmin.Startup("http://localhost:1000");Mi
当我尝试在不同的URL上启动两个应用程序时,我遇到了属性路由中间件的问题.如果我在单独的应用程序中有两个类似的路由,但使用不同的http方法web.api似乎只找到其中??一种方法.
Microsoft.Owin.Hosting.WebApp.Start<Admin.Startup>("http://localhost:1000");
Microsoft.Owin.Hosting.WebApp.Start<Startup>("http://localhost:1001");

如何隔离这两个应用程序,以便属性路由不冲突?

解决方法

根据您的上一条评论,下面的示例将过滤掉程序集:
config.Services.Replace(typeof(IAssembliesResolver),new CustomAssembliesResolver());
public class CustomAssembliesResolver : DefaultAssembliesResolver
{
    public override ICollection<Assembly> GetAssemblies()
    {
        ICollection<Assembly> defaultProbedAssemblies = base.GetAssemblies();

        //TODO: filter out the assemblies that you do not want to be probed

        return defaultProbedAssemblies;
    }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读