问题
I have a need to add/remove custom routes that were registered during the Configure() method of the Startup class via the IApplicaitonBuilder. Upon startup I call the MapRoute method within the UseMvc command to register a bunch of custom routes to my controllers which all work as expected.
I would like to create a route management feature that allows the administrator of the API to enable/disable these custom routes which means I need the ability to add/remove routes after the application has already started.
I tried getting access to the IApplicationBuilder via DI in my management controller but could not resolve it. Does anyone know if this is possible?
来源:https://stackoverflow.com/questions/50339412/asp-net-core-2-0-add-remove-routes-after-application-has-already-started