@Paul Dundon
I am using a VB.NET app and the WebAdministration API to create a website, and want to create an https binding. Is there a good example of how to do this in the documentation?
You can refer to this link: Create an SSL Binding.
Set oBinding = oIIS.Get("BindingElement").SpawnInstance_
oBinding.BindingInformation = "*:443:"
oBinding.Protocol = "https"
Set oSite = oIIS.Get("Site.Name='Default Web Site'")
arrBindings = oSite.Bindings
ReDim Preserve arrBindings(UBound(arrBindings) + 1)
Set arrBindings(UBound(arrBindings)) = oBinding
oSite.Bindings = arrBindings
Set oPath = oSite.Put_
System.Runtime.InteropServices.COMException A specified logon session does not exist. It may already have been terminated
This is an SSL certificate problem, you can try the following methods to solve the problem:
Open up certificates in MMC
Step 1: Open up a Run window and type "mmc"
Step 2: Click File > Add/Remove Snap In
Step 3: Add > Certificates, Click OK
Step 4: Choose "Computer Account", then "Local Computer" and proceed.
Step 5: Hit OK
Export Certificate in MMC
Step 1: Open "Certificates"
Step 2: Open the folder where your certificate is stored.
Step 3: Right Click on Certificate, All Tasks, Export
Step 4: Export to the server Desktop
Now you should be able to re-import your certificate into IIS (or just into MMC). Restart IIS, and Note: You may have to reimport as "Complete certificate renewal" depending on your certificate.
I'd also like to be able to set the Require Server Name Indication flag.
You can refer to the link below:
Setting "require server name indication" with c# using Microsoft.web.adminsitration.
Programmatically add binding on IIS 8 with SNI option.
IIS 8.0 Server Name Indication (SNI): SSL Scalability.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.