115

Is there a way to access Visual Studio's built-in ASP.NET Development Server over HTTPS?

Shawn Miller
  • 7,082
  • 6
  • 46
  • 54

4 Answers4

149

As of now we can use IIS Express to develop and test in SSL. Here is a complete article explaning how to use IIS Express and Visual Studion 2010 to develop websites in SSL.

enter image description here

Next

enter image description here

Then you will get this

enter image description here

Working with SSL at Development Time is easier with IISExpress

Introducing IIS Express

DreamTeK
  • 32,537
  • 27
  • 112
  • 171
Guru Kara
  • 6,272
  • 3
  • 39
  • 50
  • 7
    This answer should be bumped up, the accepted answer is very out of date. I successfully used the methods in the linked article to get SSL running via VisualStudio 2010 and IIS Express – Tom Wayson Mar 03 '12 at 20:57
  • 3
    Then just don't forget to use the SSL URL from that properties window, because if you didn't change it, next time you start debugging it'll still use the non-SSL URL (obvious, but easy to overlook..) – BornToCode Aug 06 '14 at 13:21
  • I get "Invalid hostname" when using this. – MrFox Mar 27 '17 at 10:56
  • This does not appear to work with VS2017. IISExpress should read the applicationhost.config in the /.vs/config/ folder of the solution. Anyone know the secret to make this work? – MC9000 Aug 24 '17 at 19:22
  • It sort of works for me (VS 2017 Community). When I debug I have to manually copy/paste the SSL URL into the browser...just clicking the debug button in the IDE gets me to the non-SSL version. – John Riehl Nov 26 '17 at 18:54
  • If you get the wrong properties page which doesn't look like the one above, right click on a project file in Solution Explorer, choose Properties to bring up the Properties panel, the select the web project and go back to the Properties window. – SharpC Nov 07 '19 at 13:08
38

Cassini does not support HTTPS.

However, you can use IIS to do this, if your using IIS 5.1, download the MS IIS toolpack for IIS 6.0, it comes with a tool to create self signed SSL certificates. This works on IIS 5.1

http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&DisplayLang=en

The one tool you need (SelfSSL.exe) works just fine with IIS 5.1. Unfortunately, it comes bundled with a bunch of other stuff.

Steps:

  • Install the IIS Tools File. If you want, you can click Custom and tell it to only install SelfSSL.
  • Activate the site in IIS that you want to install a SSL certificate too.
  • Go to Start / Programs / IIS Resources / SelfSSL
  • This will launch a command prompt in the SelfSSL directory.
  • Using the provided help, run SelfSSL. The command I used was: selfssl.exe /N:cn=[MACHINENAME] /K:1024 /V:90 /S:5 /P:443
  • The /S switch indicates which site to install the certificate. You can figure out the number by looking at your sites in IIS and counting (Starting at 1 for the first site, not 0), to the site you want.
  • Once this has ran, browse to your localhost over HTTPS
  • You should receive an error message stating that this certificate is from a untrusted source. You can either add your machinename to the browsers “Trusted Authorities” list, or you can tell the browser to ignore this.

At this point, you will be able to run your localhost over HTTPS.

FlySwat
  • 172,459
  • 74
  • 246
  • 311
  • 1
    There's no reason to use the stupid Built-in VS web server. Why use that when you're supposed to use IIS in the first place. Get to know IIS, stop saying it's simply too hard and too much work to just use the Create Virtual Directory button in VS which makes it completely easy for you to create one in IIS. And then get to know IIS. It's time developers stop being afraid of it. Get to know App Pools, etc. Otherwise I've seen that most devs who use the built-in server are clueless when it comes to IIS. Not good for your career if you're a developer. Couple more steps to debug, so what. – PositiveGuy Jan 09 '12 at 03:45
  • 3
    See Guru Kara's answer... IIS Express is the best answer – Lee Harold Apr 03 '12 at 19:42
12

Wilco Bauwer wrote a webdev server that will support https. He is one of the developers that worked on cassini visual studio 2005 built in web server. WebDev.WebServer2

Aaron Fischer
  • 20,853
  • 18
  • 75
  • 116
3

Select the project-file in the Solution Explorer: for example: "WebApplication1".

With pressing ALT+ENTER you enter the project-properties.

Select "DEBUG" on the left side.

Here you can select "Enable SSL".

Then you can start your project with IIS Express normally and it will start using SSL, the new Port will be 44301

MrzJkl
  • 173
  • 1
  • 9