I have a controller which have an action with a route, as shown below:
Route("{resourceType}/{id}")
my dll have some helper classes which is used by for example by another asp .net core application, now since that application also have similar routes so indirectly my controller starts conflicting with them
I solved this issue in web api, by marking my controller as internal and selecting this controller in the implementaion of IHttpControllerTypeResolver for my application.
Currently I am transferring my code to asp .net core 2.0 and I'm facing a similar problem, I tried to handle this problem using the code below -
serverInstance = new WebHostBuilder().
UseConfiguration(config)
.UseKestrel()
.UseStartup<Startup>()
.ConfigureServices(collection => {
// only fhir controller in cloud.
collection.AddMvc().ConfigureApplicationPartManager(manager =>
manager.ApplicationParts.Clear())
.ConfigureApplicationPartManager(manager => {
manager.ApplicationParts
.Add(new TypesPart(typeof(FhirController)));
collection.AddSingleton<IFhirConfiguration>(inputConfig);
})
.AddControllersAsServices();
})
.Build();
But the above code did not help, and FhirController is not detected if it is internal, if it's public it works, any idea how can I fix it?