Home > Software engineering >  When I am trying run my C# created API it is throwing an error
When I am trying run my C# created API it is throwing an error

Time:12-19

Error CS1061
'HttpConfiguration' does not contain a definition for 'MapHttpAttributeRout' and no accessible extension method 'MapHttpAttributeRout' accepting a first argument of type 'HttpConfiguration' could be found (are you missing a using directive or an assembly reference?)
CumulativeProjectJigarmehta C:\JJ\CumulativeProjectJigarmehta\App_Start\WebApiConfig.cs 15 Active

I do not understand what went wrong when I created my project...

I tried creating my project twice, it is throwing the same error both times.

CodePudding user response:

CS1061 is a compilation error, not an exception that gets thrown in runtime:

This error occurs when you try to call a method or access a class member that does not exist.

MapHttpAttributeRout looks to be a misspelling. You probably meant to call the extension method MapHttpAttributeRoutes from HttpConfigurationExtensions.

CodePudding user response:

This error is usually caused by a class name that duplicates the form name. You can change the class name that is different from the form name. If it doesn't work, please share more information.

  • Related