aspnetboilerplate: httpConfiguration ensureInitialized error?

Hi hikalkan, When i upgrade my project to abp 0.8.0.1, now i got the following exception:

{
"message": "An error has occurred.",
"exception_message": "The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after all other initialization code.",
"exception_type": "System.InvalidOperationException",
"stack_trace": "   在 System.Web.Http.Routing.RouteCollectionRoute.get_SubRoutes()\r\n   在 System.Web.Http.Routing.RouteCollectionRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)\r\n   在 System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage request)\r\n   在 System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n   在 System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n   在 Abp.WebApi.Controllers.ResultWrapperHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n   在 System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n   在 System.Web.Http.Owin.PassiveAuthenticationMessageHandler.<SendAsync>d__0.MoveNext()\r\n--- 引发异常的上一位置中堆栈跟踪的末尾 ---\r\n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   在 System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()"
}

I have see the issue[https://github.com/aspnetboilerplate/aspnetboilerplate/issues/850], it have fixed by this update, why do I have this error?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 31 (13 by maintainers)

Most upvoted comments

I discovered that if there is a problem in route configuration attributes, Web Api gives this error, it is very misleading. If you put config.EnsureInitialized(); end of your StartUp.Configuration() method, you can see the real underlying exception in a debug session.

Hi @ColinZeb,

The error message “InvalidOperationException:valuefactory attempted to access the value property of this instance” is related to OData I think. Since you didn’t configure Odata with ABP, the exception is not thrown by ABP in this project https://github.com/ColinZeb/OwinTest/. By the way, thank you for that demonstration, it helped a lot 😃.

I have applied the stes

Can you try it ? If it does not work for you, please open another issue for that.

Thanks.

@hikalkan don’t support attributeroutes?