I have an ASP.NET MVC 4.5 website, which also exposes a REST API via Web API.
I noticed that 'Application_Start' method called twice - first time when navigating to any URL on website, and second time when calling to any of REST API.
Apparently, both parts are loaded into separate AppDomains. For example, I have Unity dependency injection and I see that two containers are co-exist side by side, each one having a separate set of dependencies.
I just created a clean fresh "Web + Web API" project from VS template, and I see the same behavior - so (apparently) that is not something related to my implementation details.
Such behavior is very unfortunate - because I want to share singleton dependencies between ASP.NET MVC and Web API. Is there any solution to such issue?