Want to host a local dev site from a custom subdomain using the localtest.me approach? Follow these steps on your Windows machine to get up and running.
-
Locate your ApplicationHost.config file in \Users\YourName\Documents\IISExpress\config
-
Make a copy in case you need to revert changes
-
Open the file in your favorite text editor and scroll to
<sites>
which will be around line 155. -
Add a new
<site>
element below the default example. Use the code below as a template:<!-- Change "NewSite" to a name that suits your project --> <site name="NewSite" id="2" serverAutoStart="true"> <application path="/"> <!-- Change path to point to your web files --> <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\path-to-build-folder" /> </application> <bindings> <!-- Change subdomain and port --> <binding protocol="http" bindingInformation="*:80:custom-subdomain.localtest.me" /> </bindings> </site>
-
Open a command prompt with administrative privileges and create a new url reservation:
netsh http add urlacl url=http://custom-subdomain.localtest.me:80/ user=YourName
-
Navigate to the IIS Express folder (usually under C:\Program Files (x86)\IIS Express) and open a command prompt. Pro tip: Press SHIFT+F10, then W, then ENTER to quickly open a command prompt from any folder.
-
Start IIS Express for your new site using the following command from the IIS Express folder:
iisexpress /site:NewSite
-
Navigate to your url and test.
Notes:
%IIS_SITES_HOME%
will likely point to \Users\YourName\Documents\My Web Sites
Credits: