Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Issue with webapi attribute routing.


Hi Team,

Recently I have upgraded to the GlobalLink 11.4.3 version. But after upgrade we are facing object not initialized issue in our application.

We have web api attribute routine defined in WebApiConfig.cs initialize model. See below code for reference,

public class WebApiConfig : IInitializableModule
public void Initialize(InitializationEngine context)
// Enable Web API routing
GlobalConfiguration.Configure(config =>

name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional });
/// <inheritdoc />
public void Uninitialize(InitializationEngine context)

config.MapHttpAttributeRoutes(); is creating problem with GlobalLink 11.4.3.

when I comment this line application works but the web api's not working. I tried to add this in register method and injected dependency in Application_Start methos as well but still its not working.

Please suggest something so that I can use GlobalLink latest version and attribute routine seemlessly in my application.


Rahul Dikkar

Jul 24, 2019 10:15

Hi Rahul,

Could you please attach the exact error here?



Jul 24, 2019 10:33
This exeception is coming on browsing.

System.InvalidOperationException: The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after all other initialization code. at System.Web.Http.Routing.RouteCollectionRoute.get_SubRoutes() at System.Web.Http.Routing.RouteCollectionRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request) at System.Web.Http.WebHost.Routing.HttpWebRoute.GetRouteData(HttpContextBase httpContext)
Jul 24, 2019 11:39

I'm having the same issue. GlobalLink is involved here as well. It seems GlobalLinks configuration takes precedence over mine. Rahul Dikkar, did you manage to solve this?

Oct 07, 2019 15:16
Rahul Dikkar - Jan 16, 2020 7:10
I am able to resolve this by removing the [ModuleDependency(typeof(FrameworkInitialization))] from "WebApiConfig.cs".

This issue is resolved.

Jan 16, 2020 7:11

Coming late here, but I've actually writen a blog post about this kind of an issue:

In short, most likely the issue is caused by a third party add-on which is calling 'GlobalConfiguration.Configure' method but not calling in the implementation to 'config.MapHttpAttributeRoutes()' - and when your code tries to call the Configure method mapping the http attribute routes it will not work as the Configure method has one time logic (Configure method can be called many times but the MapHttpAttributeRoutes() call must be done when called the first time otherwise it will not work in the later calls).

Jan 19, 2020 9:41

Thank you @Antti Alasvuo! Your answer 100% applicable in my case. 

Jan 20, 2020 10:29
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.