1
我正在尝试记录我的API。我已经写在我的控制器下面的代码(VB.NET):ApiDescriptions仅返回GET函数
Function Index() As ActionResult
Dim config = GlobalConfiguration.Configuration
Dim apiExplorer = config.Services.GetApiExplorer()
Dim apiDescs = apiExplorer.ApiDescriptions
Return View(apiExplorer)
End Function
问题是,当我调试我的代码,看是什么在apiDescs
,我只能看到只有GET方法 - 我可以”没有看到任何DELETE,PUT甚至POST方法。这不是它应该如何工作。
这里是我的API的一个样本:
<HttpGet()>
Public Function GetX(x as integer) as String
'Code goes here
End Function
<HttpPost()>
Public sub PostX(x as integer)
'Code goes here
End Function
只有GetX
是内ApiDescriptions
返回无PostX
。所有API中的所有POST,PUT和DELETE方法也是如此。