问题描述
我是创建webapi方法的新手。
I'm new to creating webapi methods.
我有一个继承自ApiController的控制器。 它有一个方法:
I have a controller that inherits from ApiController. It has a method:
      [路线(&〜; api / stateandcountyfromapi / {apiNumber}")])
      public string StateAndCountyFromAPI(string apiNumber)
[Route("~api/stateandcountyfromapi/{apiNumber}")]
public string StateAndCountyFromAPI(string apiNumber)
我想我应该能够从客户端调用它as:
I figure I should be able to call it from the client such as:
api / stateandcountyfromapi /'33112244'
api/stateandcountyfromapi/'33112244'
尝试此操作时出现404错误。 我缺少的东西,但不确定是什么。
I get 404 errors when trying this. Something I'm missing, but not sure what.
Stockton
推荐答案
这篇关于WEBAPI路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!