Issue with webapi attribute routing.

Vote:
 

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,

[InitializableModule]
[ModuleDependency(typeof(FrameworkInitialization))]
public class WebApiConfig : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
// Enable Web API routing
GlobalConfiguration.Configure(config =>
{
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
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.

Thanks,

Rahul Dikkar

#205807
Jul 24, 2019 10:15
Vote:
 

Hi Rahul,

Could you please attach the exact error here?

Thanks

Ravindra

#205809
Jul 24, 2019 10:33
Vote:
 
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)
#205811
Jul 24, 2019 11:39