Running IIS Express without administrator rights

2019-01-31 12:44发布

问题:

I've upgraded to iis express 7.5 with VS2010 SP1. Within the release notes it specified that express is able to run WITHOUT administrator permissions. When I try to run from the commandline (powershell cmd line) I receive the same "Access Denied" error (shown below) I was getting running with IIS Express 7.

As far as I can tell admin rights is still required.

Anyone been able to run without admin rights?

The detailed error message is:

Failed to call HttpAddUrl with http://MACHINE-NAME:80/
Failed to register URL "http://MACHINE-NAME:80/" for site "WebSiteName" application "/". Error description: Access is denied. (0x80070005)

回答1:

See here for what requires admin access and what doesn't, depending on what you are doing with IIS Express: http://learn.iis.net/page.aspx/1003/running-iis-express-without-administrative-privileges/

Administrative privileges are required in order to perform the following tasks:

* Use a reserved port such as 80 or 443.
* Serve requests for external traffic.
* Configure a custom SSL certificate.
* Run SSL using a port outside the range of 44300 to 44399. 

So if you are doing any of the above, admin access will be required.

This is irrespective of 7 or 7.5.



回答2:

It is also possible to run IIS Express as a non administrative user on reserved ports and serve requests for external traffic but you need to configure the HTTP service to allow this. The Netsh Commands for Hypertext Transfer Protocol (HTTP) technet page describes this in detail for a Windows 7 machine (also Vista, Server 2008 etc). As you would expect you need to run the configuration command as an administrator. Examples of the command to add and delete the permission are:

netsh http add urlacl url=http://YOUR-MACHINE-NAME:80/ user=DOMAINNAME\GroupOrUserName
netsh http delete urlacl url=http://YOUR-MACHINE-NAME:80/

This works for me on Windows 7 and although I can't verify it, I expect the Httpcfg.exe: HTTP Configuration Utility can be used to allow this on earlier versions of Windows (XP, Server 2003).



回答3:

open CMD as administrator and run bellow statement

netsh http add iplisten ipaddress=::