Is it possible to use custom host headers / bindings with IIS7 Express?

后端 未结 2 1046
春和景丽
春和景丽 2021-02-01 22:29

I\'m trying to configure a new ASP.NET MVC3 using IIS7 express (on my local development machine) to use a custom domain name.<

2条回答
  •  情歌与酒
    2021-02-01 23:11

    1. Stop currently running site if it is running

    2. Open %userprofile%\documents\iisexpress\config\applicationhost.config
      for VS2015+ :$(solutionDir)\.vs\config\applicationhost.config

    3. Locate the site you are interested in and it would have a binding like

    4. Now add a similar entry just below the above bindig entry.

    5. run the site again

    NOTE: You must start visual studio as administrator because non-localhost binding requires administrator privileges


    Update By Pure Krome:

    Further to this, we need to do the following. These comments are in the top of my web.config (along with a few other stuff...).

    1) netsh http add urlacl url=http://localhost.www.foo.com:80/ user=everyone
       netsh http add urlacl url=http://localhost.foo.com:80/ user=everyone
       netsh http add urlacl url=http://localhost.foobar.com.au:80/ user=everyone
       netsh http add urlacl url=http://localhost.pewpew.com:80/ user=everyone
       ... etc ... 
       NOTE: to remove a urlacl: netsh http delete urlacl url= .. eg http://foo.com:80
    
    2) ... and we need to edit the main IIS7 express config file to define the url's which will be accepted, per web -site-
        File: C:\Users\\Documents\IISExpress\config\applicationhost.config
    
        
        
        
        
        
    
    

提交回复
热议问题