ASP.NET-Core 2.0 Add/remove routes after application has already started

感情迁移 提交于 2019-12-12 14:10:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!