Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John Hildebrant 14 posts 35 karma points
    Aug 22, 2014 @ 19:56
    John Hildebrant
    0

    Internal Server Error when calling Web API Controller

    I have created a controller that Umbraco.Web.WebApi.UmbracoApiController.

    I have created a class to inherit ApplicationEventHandler and override ApplicationStarting to add my API route:

    RouteTable.Routes.MapHttpRoute(
                    "DefaultApi",
                    "Umbraco/api/{controller}/{id}",
                    defaults: new { id = System.Web.Http.RouteParameter.Optional }
                    );

    Yet, when my script does a GET for this API, I get a 500 error response. If I open the URL in Google Chrome, I get the following:

    <Error>
    <Message>An error has occurred.</Message>
    <ExceptionMessage>
    Object reference not set to an instance of an object.
    </ExceptionMessage>
    <ExceptionType>System.NullReferenceException</ExceptionType>
    <StackTrace>
    at Umbraco.Web.WebApi.NamespaceHttpControllerSelector.SelectController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage request, CancellationToken cancellationToken) at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    </StackTrace>
    </Error>

     

    Any ideas on what is going wrong?

    Thanks,

    John

  • Paul 10 posts 103 karma points
    Aug 22, 2014 @ 23:04
    Paul
    0

    Hi John,

    You might be running into this issue that has just be raised, http://issues.umbraco.org/issue/U4-5384

    Hopefully the work around works for you.

    Paul

Please Sign in or register to post replies

Write your reply to:

Draft