Wednesday, October 10, 2012

MVC 4, Signal R & Web API Dual Start Up Projects!

For a while now I've been using Visual Studio 2012 and investigating it's new features (which are many) as well as looking at the new project types and other offerings such as the new project templates and new technologies like Signal R. I decided that the best way to get a handle on all of this was to create a sample solution using as much of it all together as possible. My idea was to have a solution with a couple of projects, I'd use MVC 4 with Signal R for the Web UI and a Web API project as my Service/Data layer. To that end I set about creating the solution with two projects. At this point I was a stuck - how do I run both the Web UI front end and the Web API service layer at the same time - traditionally you only have 1 start up project!

This is where Visual Studio 2012 with IIS Express comes in handy - you can set Multiple Start up projects really simply. In essence all you have to do is right click on each project in turn - go to the web tab of the properties page and ensure both projects are using IIS Express and using different ports. Then right click on the solution node then click Properties. Select the Common Properties node then Start up Project. Click the radio button that says Multiple Start up projects and use the Grid to select the start up action of each project within the solution. With that done all you need do is hit F5 and both projects will start-up (and debug if desired) and you're ready to go!

Post a Comment