如何配置Swashbuckle以识别以后缀“ Service”而不是“ Controller”命名的WebAPI REST服务类。我已经对WebApi.config进行了调整,以使用代码识别后缀“ Service”:
var suffix = typeof(
System.Web.Http.Dispatcher.DefaultHttpControllerSelector )
.GetField( "ControllerSuffix", BindingFlags.Static |
BindingFlags.Public );
if ( suffix != null ) suffix.SetValue( null, "Service" );
如
中所述
https://www.strathweb.com/2013/02/but-i-dont-want-to-call-web-api-controllers-controller/
我可以以此运行其余服务,但是大摇大摆无法识别“服务”后缀