Quarterbore
New Member
Is there an elegant way to run code from two separate ASP.NET web projects side by side in the same worker process? BackgroundMy team maintains a large ASP.NET WebForms application. We're also developing Android/iOS apps that consume an API, which we've built using Microsoft's new WebAPI framework. The WebForms app and API are currently set up as separate sites in IIS, but this isn't a workable long term solution. Our application handles multiple tenants, each with a different database. We use NHibernate heavily, and each client needs their own heavy \[code\]SessionFactory\[/code\] object. The WebForms app thus has a large memory footprint, and running the API as a separate IIS site essentially doubles the memory required for each client.Hosting the API inside the WebForms app should enable both to share NHibernate resources and lessen the memory pressure.Currently, the web application and the API live in different solution files, but they both have a link to a common business logic/data access project, \[code\]Core\[/code\].Our web application solution looks like this (simplified):\[code\]MyWebFormsApplication- Core- WebFormsProject- AnotherProject- AnotherProject1- AnotherProject2- AnotherProject3\[/code\]And our API solution looks like this:\[code\]MyAPI- Core- WebAPIProject\[/code\]Ideally, I'd like both the Webforms app and the API to live together in the same solution:\[code\]MyHappyCombinedApplication- Core- WebFormsProject- WebAPIProject- AnotherProject- AnotherProject1- AnotherProject2- AnotherProject3\[/code\]OptionsWe could add each API file as a link inside of the WebForms project, but this would be a major maintenance hassle. The only other option I can think of is just ditching the separate API project altogether and merging the API and WebForms projects. The reason I'd prefer to keep API in its own project is that we could continue to develop the API from a smaller solution file that doesn't have all the extra baggage of our main solution, which means faster builds.Is this even remotely feasible?