Make Localhost a Custom Domain in IIS Express

2019-01-21 20:38发布

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!

2条回答
姐就是有狂的资本
2楼-- · 2019-01-21 21:14

Do the following

  1. If IIS Express is running stop it
  2. Open your webapplication project file (*.csproj or *.vbproj)
  3. Find <IISUrl>http://localhost:61156/</IISUrl> and change it to <IISUrl>http://devserver.com:61156/</IISUrl>
  4. Open %userprofile%\documents\iisexpress\config\applicationhost.config file

  5. 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

  6. Find your site entry in applicationhost.config file change the binding as shown below
    <binding protocol="http" bindingInformation="*:61156:devserver.com" />
  7. In \Windows\system32\drivers\etc\hosts file add following mapping "127.0.0.1 devserver.com"
  8. In your browser add exception to bypass proxy for devserver.com
  9. Note that, since you are using custom domain (non localhost binding), you must run visual studio as Administrator
查看更多
欢心
3楼-- · 2019-01-21 21:29

@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

查看更多
登录 后发表回答