更新时间:2023-02-16 23:24:20
好的,看来我已经成功了.当您将第一个 API 控制器添加到未检查 Web API 的项目时,会弹出一个自述文件,其中包含一些附加信息:
Ok, seems I got it working. When you add your first API controller to a project that does not have the Web API checked, a readme file pops up with some additional information:
我尝试添加
WebApiConfig.Register(GlobalConfiguration.Configuration);
到 global.asax 并且它不起作用.自述文件显示以下代码
to the global.asax and it did not work. the readme show the following code
GlobalConfiguration.Configure(WebApiConfig.Register);
那行得通,虽然(在我看来)两条线做的完全一样??
that DOES work, although it seems (to me) that both lines do exactly the same thing??