问题
I am using IIS Express in Visual Studio 2010 and right now it runs on localhost:61156. But I need it to run on a domain. Is it possible to make IIS Express to run on devserver.com, instead of localhost:61156? So basically when I run debug I want devserver,com, instead of localhost:61156. I've come across a few things on google, but no luck. Any ideas on how to do this?
Thanks!
回答1:
Do the following
- If IIS Express is running stop it
- Open your webapplication project file (*.csproj or *.vbproj)
- Find
<IISUrl>http://localhost:61156/</IISUrl>
and change it to <IISUrl>http://devserver.com:61156/</IISUrl>
Open %userprofile%\documents\iisexpress\config\applicationhost.config file
Visual Studio 2015 now puts an applicationhost.config file specific to your project instead of using the global one. It is located at: /path/to/code/root/.vs/config/applicationhost.config
- Find your site entry in applicationhost.config file change the binding as shown below
<binding protocol="http" bindingInformation="*:61156:devserver.com" />
- In \Windows\system32\drivers\etc\hosts file add following mapping "
127.0.0.1 devserver.com
" - In your browser add exception to bypass proxy for devserver.com
- Note that, since you are using custom domain (non localhost binding), you must run visual studio as Administrator
回答2:
@vikomall's answer is the correct one, but I don't have enough reputation to comment yet, so I'm adding an extra answer here with a clarification for Visual Studio 2015.
Visual Studio 2015 now puts an applicationhost.config file specific to your project instead of using the global one. It is located at: /path/to/code/root/.vs/config/applicationhost.config
Follow the same steps as @vikomall's answer, but use the path above for step #4.
See Mike Dice's Blog
来源:https://stackoverflow.com/questions/11249633/make-localhost-a-custom-domain-in-iis-express