Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running IIS Express with admin privileges

This has been asked before but was closed as "Not a real question"

https://stackoverflow.com/questions/7450813/how-to-run-a-site-with-administrative-privileges-in-iis-express-7-5

However I think it is a genuine question as I also need to do this, there are MS documents explaining how to "Run IIS Express without Administrative Privileges" but as this is how it runs by default the need for this article quite frankly baffles me. However I have no idea on how to run it with Admin privileges.

When I try to start my VS2012 website I get the following error message from IIS express: "Cannot start the website because administrative privileges are required to bind to the hostname or port", and links are provided to the MS documents about running it without admin privileges.

What I'm ultimately trying to do is run my dev sites locally as http ://vs2012:nnnnn, this is so I can attach fiddler debugger (due to the bypass of proxies in IE when localhost is used)

This used to work fine, this morning I did a reinstall of windows and have now hit a brick wall!

Does anyone know how to give IIS express admin privileges as indicated in the error message?

like image 428
Morvael Avatar asked Nov 19 '12 13:11

Morvael


People also ask

Does IIS Express require admin rights?

IIS Express was designed to allow the most common web development and testing tasks to be performed without administrative privileges.

How do I run IIS as administrator?

To run IIS Manager with administrative privileges on the server machine, instead of logging on as an administrator, it is recommended you use the runas command in the non-administrative user context, for example: runas /user:<AdministratorAccount> “%SystemRoot%\system32\inetsrv\inetmgr.exe”. ...

What user does IIS Express run as?

IIS Express runs as your user account. When installed, you should find an IISExpress folder in your My Documents folder.


2 Answers

For Visual Studio 2015 and 2012 this solution will work.

  1. Go to Solution Explorer in Visual Studio, right click the web project and select "Unload Project"
  2. Next on the same project, right click and select ‘Edit Project File‘
  3. Find the
    <DevelopmentServerPort>0</DevelopmentServerPort><IISUrl>http://localhost:56058/</IISUrl>
    xml tags and and remove them.
  4. Reload the project and run.

Images to follow:

enter image description here

like image 164
Charitha Goonewardena Avatar answered Sep 29 '22 10:09

Charitha Goonewardena


I've worked it out.

I switched Visual Studio to running with Administrative Privileges and also found the .exe for IIS Express and set that to always run with administrative privileges. I'm not 100% sure the second was needed but did them both anyway.

I hope this helps some one else who's had this same issue.

EDIT

(19/08/2013)

This only seemed to work in Windows 7, On Windows 8 I eventually just gave up and now use the full blow IIS for all my dev work.

EDIT

(07/06/2018)

@Tarostar (Comment below), got this working on Windows 10 VS2017 and a number of others have got it to work on Windows 8 prior to that using the same method. So possible I was doing something wrong on my Windows 8 box.

like image 44
Morvael Avatar answered Sep 29 '22 10:09

Morvael