3

I enabled SSL in Visual Studio 2015 in order to implement Facebook and Google login locally.

I changed the project URL in the Web tab of the project's properties to https://localhost:44300/ and decorated the controller with the RequireHttps attribute - ref @msdn.

Everything worked fine locally.

I reverted settings to HTTP to test something else and that caused me a problem when I tried to get back to HTTPS.

I found this SO question and tried almost every suggested solution.

Error detail:

Failed to register URL "url" for site "site" application "path". Error description: Access is denied. (0x80070005).

1
  • You should extract the answer part to an answer and accept it. That's the format of an FAQ if you read other posts. Commented Apr 2, 2016 at 1:26

3 Answers 3

12

I had to issue this command in DOS to solve the problem in VS 2015:

netsh http add urlacl url=http://{ip_addr}:{port}/ user=everyone 

Strangely this was only needed when I moved the project to a different PC. On the original PC I didn't need it.

Sign up to request clarification or add additional context in comments.

3 Comments

Note that , 127.0.0.1 and localhost are treated as separate... netsh http delete urlacl url=http://:10001/ netsh http add urlacl url=http://*:10001/ user=everyone netsh http delete urlacl url=127.0.0.1:10001 netsh http add urlacl url=127.0.0.1:10001 user=everyone netsh http delete urlacl url=localhost:10001 netsh http add urlacl url=localhost:10001 user=everyone
You can also add only your user to ACL with user=<your Windows user name> instead of everyone.
This worked for me as well. Can anyone elaborate on why this worked?
3

Turned out this very answer on the same question thread by Cayne led me to the solution.

The port change didn't work because applicationhost.config file, located in .vs folder specific for VS2015, kept bindings combo of old port for Http and Https as a default setting. No matter how many times did I change port to something else while trying with Http (only got clogged with mass of new web site bindings in the config file) as soon as I wanted to switch back to SSL it ended up with the first bindings combo. The port it complained about that can't be registered any more.

Once I deleted that first bindings combo everything was fine.

I hope this will help someone in the future.

Comments

0

Go to C:\Users{username}\Documents\IISExpress\config and open the applicationhost.config file.

Search for the <sites> tag in the document. You will see some lines similar to the following.

<site name="WebSite1" id="1" serverAutoStart="true"> <application path="/"> <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" /> </application> <bindings> <binding protocol="http" bindingInformation="*:8080:localhost" /> </bindings> </site> 

Replace the line <binding protocol="http" bindingInformation="*:8080:localhost" /> as follows.

<binding protocol="http" bindingInformation="*:{required_port_number}:*" /> 

I think you can even remove the * marks in bindingInformation.

Then restart IIS Server (remove all IIS server related operations using Task Manager and go to C:\Program Files\IIS Express folder and run iisexpress.exe: you might need to Run as Administrator).

A console will open and if all went well, following lines will be displayed.

Successfully registered URL "http://*:{required_port_number}/" for site "Website1" application "/" ...

Also check in browser whether the required URL works now.

Here's a very useful resource...

1 Comment

FYI Visual Studio will now create an iis express config file in folder .vs/$solution/config, and pass that file as an argument when starting the web site.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.