Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs
Contact   •   Articles   •   Products   •   Support   •   Search
Ad-free experience sponsored by:
ASPOSE - the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more

Opening a WAP IIS Project when IIS Virtual doesn’t exist


:P
On this page:

I frequently create copies of Web projects to test locally on my machine either for pre-deployment testing or for distribution to other developers to make sure the project loads, compiles and runs correctly. Ideally I should be using a separate machine for this, but often there isn’t one available. Long story short local duplication happens occasionally.

So to test I copy the project to a new location or check it back out of source control in a new location. Now since I use IIS locally for testing rather than the VS Web Server, when I open the project I get a nice dialog that asks if I want to create the virtual, which is thoughtful enough in most situations:

IISVirtualDialogInVs

If you click Yes Visual Studio appropriately creates your virtual directory for you and loads your project. Cool.

Except when you don’t want it to create a new virtual. So if I’m testing the Web app (or get it ready for re-distribution) I often end up with multiple instances of the same Web app on the same machine and in that case I really don’t want to create a new virtual. Unfortunately, if you decline to create the virtual there are no further options and the project unceremoniously isn’t loaded for you. Bummer.

The fix for this is easy enough: You can open up the project file and change the <UseIIS /> key to false:

<ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>False</UseIIS>

</WebProjectProperties> </FlavorProperties> </VisualStudio> </ProjectExtensions>

Which effectively changes the project to using built-in Web Server. Now you can re-open the project and it will load although you may have to adjust your security settings to work with the local server.

It’d be nice if VS would provide another option to make this change for you, if you don’t opt to create the virtual. Not loading the project because the virtual doesn’t exist is kinda lame, especially since the project is completely dropped from the solution and not even shown as an unloaded project. The VS workflow for this certainly could be better. If you decline to create a virtual the app should be automatically switched to use the local Web server or at the very least it should be added to the solution as an unloaded project so at least you can edit the XML right there.

The no-load seems especially unnecessary since IIS is required only to run/debug the project, not to actually loading or compiling the project which – unlike in VS 2003 – uses the file system to load the project.

Posted in ASP.NET  

The Voices of Reason


 

Ray Mueller
March 24, 2009

# re: Opening a WAP IIS Project when IIS Virtual doesn&rsquo;t exist

Excellent post as it is timely. I happened to open a project created on someelse's workstation and received this message. I looked over the project file as I suspected that the fix was there however I had to move on to other projects to come back to this one at a later time.

Thanks for writing the article as it will be a time-saver!

Ray

DotNetShoutout
March 25, 2009

# Opening a WAP IIS Project when IIS Virtual doesn’t exist - Rick Strahl

Thank you for submitting this cool story - Trackback from DotNetShoutout

Gerardo Contijoch
April 10, 2009

# re: Opening a WAP IIS Project when IIS Virtual doesn&rsquo;t exist

Great post!
It always happens to me and I'm forced (well, not anymore!) to create the Virtual Directory.

Thank you!
 

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2019