June 04, 2011
Moving a website in WebMatrix
I created a website in WebMatrix and decided later to move it to a different location. Since the site's files are all self-contained, I just moved them in Windows Explorer. However, when I opened up WebMatrix, I went to My Sites and clicked on the site:
However, this resulted in an error:
Of course. So the question is how to get WebMatrix to understand the site's new location. Turns out to be pretty easy. The site information is in the applicationhost.config file which is in turn in (here's the not-intuitive part) the My Documents\IISExpress\config folder.
This is an XML file that has a element containing a child element for each site that WebMatrix knows about. All I had to do was change the highlighted bit to point to the new location:
<site name="MotorcycleBlog" id="11">
<virtualDirectory path="/" physicalPath="C:\MotorcycleBlog" />
<binding protocol="http" bindingInformation="*:6867:localhost" />
And thereafter WebMatrix opened the moved site from the correct location.