1

私の WebAPI ルートは次のように定義されています。

config.Routes.MapHttpRoute(
  name: "BuildModels",
  routeTemplate: "api/build/models/{productLine}/{language}",
  defaults: new { controller = "Build", action = "GetModels" }
);

コントローラ:

public class BuildController : ApiController
{
    public async Task<HttpResponseMessage> GetModels(string productLine, string language)
    {
        // Omitted for brevity, I don't feel it's pertinent
        // but if you disagree I will fill this in.  
        // Nothing has changed in here and it worked before.
        return await ...;
    }
}

/api/build/models/x/en

[HttpException]: The controller for path &#39;/api/build/models/x/en&#39; was not found or does not implement IController.
   at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

/api/ビルド/モデル/x/

{"Message":"The arguments value is not valid : {language}"}

以前に機能していたこの単一のコントローラーのルートを除いて、すべてのルートが機能しています。私は明らかに何かを変更しましたが、何がわかりません。

4

1 に答える 1