在使用.NET Core3.0运行Web应用程序时,我会遇到以下错误。我已经实现了属性路由,并在statup.cs的配置方法中使用了以下代码
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});错误:
crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
Application startup exception
System.ArgumentException: There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character. (Parameter 'routeTemplate')
---> Microsoft.AspNetCore.Routing.Patterns.RoutePatternException: There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character.
at Microsoft.AspNetCore.Routing.Patterns.RoutePatternParser.Parse(String pattern)
at Microsoft.AspNetCore.Routing.Patterns.RoutePatternFactory.Parse(String pattern)
at Microsoft.AspNetCore.Routing.Template.TemplateParser.Parse(String routeTemplate)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Routing.Template.TemplateParser.Parse(String routeTemplate)
at Microsoft.AspNetCore.Mvc.ApplicationModels.InferParameterBindingInfoConvention.ParameterExistsInAnyRoute(ActionModel action, String parameterName)
at Microsoft.AspNetCore.Mvc.ApplicationModels.InferParameterBindingInfoConvention.InferBindingSourceForParameter(ParameterModel parameter)谢谢!
发布于 2020-04-14 17:24:58
我已经解决了这个问题。我忘了在我的属性路由中为其中一个Http操作添加结束"}“。
[HttpPost("{id}/like/{recipientId")]如您所见,在recipientId之后缺少"}“。我认为这个错误完全是误导性的。
https://stackoverflow.com/questions/61213534
复制相似问题