当我尝试在不同的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; } }