0
MVC web api 메서드를 다른 이름으로 실행하는 방법은 GET 및 POST입니다. 나는 실행할 수 없다. 그것은 오류를 보여줍니다. 여기 내 코드가있다.GET 및 POST를 사용하는 MVC 웹 API
webapiconfig.cs
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { action = "get", id = RouteParameter.Optional }
);
직원 컨트롤러
는 :[HttpGet]
public string Test1()
{
return "this is a test1 string";
}
[HttpGet]
public string Test2()
{
return "this is a test2 string";
}
[HttpPost]
public string Test3()
{
return "this is a test3 string";
}
난 두 게시물을 실행하고 다른 시나리오에서 모든 방법을 얻을합니다. 그것을하는 방법?
형식과 사투를 벌인. 서식있는 행동 양식. 누구든지 포맷을 수행 할 수 있습니다. –