Make Localhost a Custom Domain in IIS Express

不打扰是莪最后的温柔 提交于 2019-11-27 10:51:53

问题


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

  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



回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!