16

I feel like I must be missing something easy, but does anyone know how to enable SSL for IIS Express when using an ASPNET5 web project? The Project Properties Debug screen only shows a port, not a URL ("classic" web projects still allow you to specific https in the url)

2

5 Answers 5

14

Edit your applicationhost.config in [SOLUTION_DIR]\.vs\config

for exemple in the sites section :

<site name="YOUR SITE NAME" id="1">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
      <virtualDirectory path="/" physicalPath="YOUR SITE PATH" />
    </application>
    <bindings>
      <binding protocol="http" bindingInformation="*:80:localhost" />
      <binding protocol="https" bindingInformation="*:44300:localhost" />
    </bindings>
</site>
8
  • 4
    I hope this isn't the only way cause this is terrible. Commented Jul 15, 2015 at 19:59
  • @SailingJudo I don't get why u think it's terrible. Commented Jul 16, 2015 at 7:39
  • 12
    VS2015 RTM seems to be locating config in $[solutionDir]\.vs\config\applicationhost.config
    – fiat
    Commented Jul 23, 2015 at 3:43
  • 1
    In RC2 you can edit the launchSettings.json file in /Properties. Commented Feb 12, 2016 at 17:07
  • Which binding do I edit? I have multiple bindings in my applicationhost.config. One under <site name="WebSite1" id="2"> and one under <site name="WebApplication1" id="2">. It is a C# MVC Web App. See how I created it here: work.haufegroup.io/haufe-adfs-identity-for-aspnet-login Commented Jan 4, 2018 at 16:01
13

You do this in a vNEXT project almost exactly the same as prior projects. Microsoft just moved the settings to the debug tab of the project properties.

  1. Open the properties of the project
  2. Select the debug tab on the left
  3. Tic the checkbox for Enable SSL

enter image description here

If yout don't have the above option

Click the project root node in the explorer window, press F4 and adjust the following:

enter image description here

3
  • 3
    This worked for me and is a MUCH BETTER solution than the accepted answer of editing the applicationhost.config. IMO the accepted answer should be changed to this one.
    – RonC
    Commented Aug 24, 2016 at 14:05
  • Debug tab is missing in my Visual Studio 2015 and 2017...perhaps it was removed? Commented Jan 4, 2018 at 15:58
  • when you incorperated other answers from this question into your own, I think it would have been best practice to change your post to community wiki
    – Kevin
    Commented Jan 28, 2020 at 12:44
12

This can be done simply if you click on the project in the Solution Explorer the open the Properties and set the SSL Enabled to True.

Enable SSL VS2015

3
  • Visual Studio 2015 shows this to be the answer for an MVC project. Just select the project and select SSL enabled to be true in the properties pane.
    – EeKay
    Commented Dec 6, 2016 at 9:35
  • What is I use IIS instead of IIS express? There is no such setting, only if I choose IIS Express. Commented Dec 8, 2016 at 14:26
  • 3
    You need to open a properties window instead of property page. You can open the properites window in View > properties window (F4)
    – Kuroro
    Commented Mar 16, 2017 at 4:54
8

Click on the project and press F4, it will show the same properties list as previous visual studio versions where you can set SSL to true.

It will look like this in VS 2015

Example

1
  • this works, but if you need to edit the grayed out fields (ssl url, url) you'll need to see tom mcdonald's answer above. Commented Oct 16, 2018 at 15:05
1

None of the solutions above apply if you are doing .Net 4.5 MVC project with "on premise", aka, ADFS authentication. If so, you won't see a 'debug' tab (see image below). You won't see an "Enable SSL" toggle box. Everything is done automatically by the IDE as long as you select a port in the acceptable range. I used the port 44300 and VS configured the /.vs/config/applicationhost.config file automatically (see below). I think VS might automatically setup SSL with the other authentication types (OAuth, etc.), but I haven't tested it.

ADFS SSL Visual Studio

4
  • Note, I did have to manually set the project URL (shown in the image) to port 44300. Even though I'd specified the URI as {httpss://localhhost:44300} in the 'on premise' authentication setup, VS didn't carry that through to the Project Url. That's probably by design as URI <> URL. Commented Jan 15, 2018 at 15:49
  • update: I was able to find the "SSL Enabled" property window in VS 2017. It appears to be deprecated, but it still works. Select the project in solution explorer and then press F4. Changes there will update the config file as described above. For more information go to provenstyle.com/blog/2015/10/02/… Commented Jan 17, 2018 at 20:03
  • confirmed the F4 menu does the same thing as directly editing the [project root]/.vs/config/applicationhost.config file. See the system.webserver.security.authentication node for authentication settings. I wanted to turn SSL off for IIS express so I set anonymousAuthentication = true and windowsAuthentication = false Commented Jan 18, 2018 at 14:15
  • Some fields are grayed out for F4. To edit them you must directly edit the config file using a text editor. Commented Oct 16, 2018 at 15:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.