Multiple actions were found that match the request Web API?

后端 未结 8 1207
再見小時候
再見小時候 2020-12-09 08:09

I am using web API and i am new in this. I am stuck in a routing problem. I have a controller with following actions :

    // GET api/Ceremony
    public IEn         


        
8条回答
  •  鱼传尺愫
    2020-12-09 08:49

    Edit Your WebApiConfig.cs in App_Start folder on the root of project and add {action} to routeTemplate parameter in MapHttpRoute Method like below :

     config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
    

提交回复
热议问题