Monday, December 19, 2011

How To: Local IIS Express using Different Host Name other that LocalHost

So, I don't like doing development on localhost. Just a pet peeve... until I found out that jquery hates it more. Trying to do ajax postbacks on a locally running service (at http://localhost:someport) failed.

In Visual Studio 2010you can set the project to use IIS Express but if you don't have "things" set right it will fail. (IIS Express doesn't, out of the box, listening to web requests for host headers other than localhost)

Create host name to point localhost to something more-fun-er by adding an alias to:

c:\windows\system32\drivers\etc\hosts

Add a line:
127.0.0.1 mylocal.dev

Then open

My Documents\IISExpress\config\applicationhost.config
Search for your Application name and change the listening settings for your app




Save the file. In Visual Studio change your project to point to the new host name:



now your app will run nicely in it's "new" home :)
Add to Google