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

前端之家收集整理的这篇文章主要介绍了c# – OWIN无法使用webapp.start隔离运行多个应用程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试在不同的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;
    }
}

猜你在找的C#相关文章