我刚刚在我的 WebAPI 项目上更新(从 v3.x)到最新版本的 AttributeRouting,它刚刚开始产生我以前从未见过的错误。
现在,每当调用 API 时,我都会收到如下错误:
System.InvalidOperationException: The constraint entry 'inboundHttpMethod' on the route with route template 'my/path' must have a string value or be of a type which implements 'IHttpRouteConstraint'.
at System.Web.Http.Routing.HttpRoute.ProcessConstraint(HttpRequestMessage request, Object constraint, String parameterName, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.ProcessConstraints(HttpRequestMessage request, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)
at AttributeRouting.Web.Http.Framework.HttpAttributeRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)
at System.Web.Http.WebHost.Routing.HttpWebRoute.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context)
at System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
它已经工作了几个月没有问题。
没有文档详细说明有任何使用更改。我的配置文件看起来正确。
出了什么问题?我找不到其他人报告这个。