Reconfigure a Project to Use IIS Express in Visual Studio

Apparently, back in the day, they had enough spare RAM on their development machines to run a full copy of IIS.

We're not so privileged today, but if you inherit one of these projects, you may end up looking at error messages like this:

MyProject.csproj : error  : The Web Application Project MyProject is configured to use IIS.  Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.

Or this:

MyProject.csproj : error  : The Web Application Project MyProject is configured to use IIS.  The Web server 'http://www.myproject.local/' could not be found.

Because on your weedy i7 CPU, bogged down by too many background processes, you've opted not to install a full copy of IIS and use IIS Express instead.

Projects that are configured to use IIS won't even load on machines that don't have it installed, but fortunately, it's easy to open up the XML in the csproj file and make the changes that you need to reconfigure the project to use IIS Express instead.

First, you'll need to add the UseIISExpress property and set to true in the first PropertyGroup in your csproj.

<UseIISExpress>true</UseIISExpress>

Then, under Project Extensions -> VisualStudio -> FlavorProperties -> WebProjectProperties, make the following changes.

<WebProjectProperties>
    <UseIIS>False</UseIIS>
    <AutoAssignPort>True</AutoAssignPort>
    <DevelopmentServerPort>3000</DevelopmentServerPort>
    <DevelopmentServerVPath>/</DevelopmentServerVPath>
    <IISUrl>http://localhost:3000</IISUrl>
    <NTLMAuthentication>False</NTLMAuthentication>
    <UseCustomServer>False</UseCustomServer>
    <CustomServerUrl>
    </CustomServerUrl
    <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>

Clicking 'reload project' in your solution explorer will now load the project for you. Of course, you can change the port number to anything you want (just make sure that they match under both DevelopmentServerPort and IISUrl)