IIS 7 and Above
error 1312 when trying to add certificate to binding
Last post Aug 29, 2012 05:12 PM by Schweinehund
Apr 28, 2010 07:59 PM|Mozleron|LINK
I am attempting to associate a SSL certificate with a specific binding item in IIS.
This page seems to say that it's really easy to do, and the code does look easy:
However, when i run the last couple lines where you associate the certificate with the binding, i get an error 1312:
PS IIS:\> get-item cert:\LocalMachine\MY\3E968E9ED3EF23ECFD1B2F9AF8B6A69789297DA2 | new-item IIS:\SslBindings\10.1.1.2!443
New-Item : Failed to create SSL binding. Error code 1312.
At line:1 char:83
+ get-item cert:\LocalMachine\MY\3E968E9ED3EF23ECFD1B2F9AF8B6A69789297DA2 | new-item <<<< IIS:\SslBindings\10.1.1.2!443
+ CategoryInfo : InvalidData: (:) [New-Item], ProviderException
+ FullyQualifiedErrorId : Failed to create SSL binding. Error code 1312.,Microsoft.PowerShell.Commands.NewItemCommand
I've been digging around for the answer to this, but have not come across anything that lets me know how to make this work.
I do have the web-administration module loaded, and get this error regardless of how i attempt to invoke the command.
I am on Windows Server 2008 SP2, using Powershell 2.0.
May 05, 2010 08:29 AM|WenJun Zhang - MSFT|LINK
Error 1312 usually indicates there is problem with the certificate or it's simply corrupt. Can you successfully add SSL binding with this cert in IIS7 UI?
You may also test with a self-signed cert issued with IIS to verify this.
Aug 29, 2012 05:12 PM|Schweinehund|LINK
I received a similar error and resolved it like this (using your code).
get-item cert:\LocalMachine\MY\3E968E9ED3EF23ECFD1B2F9AF8B6A69789297DA2 | New-Item
-Type Directory 10.1.1.2!443