Friday, August 27, 2010

"netsh" common errors


The “netsh” command can be useful in some WCF self hosting scenarios. I have previously shown how it can configure certificates for ssl.

For example this command will bind a certificate identified by the given hash on the 8732 local port.

$> netsh http add sslcert ipport= certhash=4f35f9386692f45b6cc35b7e786c9f06625b9567 appid={00112233-4455-6677-8899-AABBCCDDEEFF}

You may encounter this error when runing the command:

SSL Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated.

Solution: This can mean that the certificate referenced by the hash does not have a private key. You may also want to verify that the private key has enough permissions.

Another famous error is:

SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists.

Solution: This will happen if you try to bind the certificate to a port which is already binded to this or another certificate. If you want you can delete the existing binding:

$> netsh http delete sslcert ipport:


What's next? get this blog rss updates or register for mail updates!

Sunday, August 22, 2010

Reflector gotcha: Identical class names


Some time ago I inspected WSE2's MessageSignature.CreateTransform method in the reflector.

Here is a snippet from it:

if (transform is XmlDsigXPathTransform)


return new XmlDsigXPathTransform();


It seemed what I was looking for at the moment so I pasted it into my project. Immediatelly ReSharper suggested me to add a using to "Microsoft.Web.Services2.Security". I hoped to save a few coding seconds so I accepted the offer.

A few hours later I have encountered some strange behavior at runtime which forced me to check this code again. It looked identical to the WSE2 code from the reflector so I assumed it should work. It still looked identical in the second and third times I checked but then... I hovered over the first XmlDsigXPathTransform in the reflector and saw it was from the "System.Security.Cryptography.Xml" namespace! It turned out that the code used two classes with the same name but from different namespaces. Seems like the reflector will not add the full namespace even in case of ambiguity.

Keep that in mind next time you copy WSE2 code to your projects :)


What's next? get this blog rss updates or register for mail updates!

Saturday, August 7, 2010

Mime Attachments (Swa) for Wcf


As we know from the web services attachments matrix, Wcf does not natively support Soap With Attachments (SwA, sometimes referred to as Mime attachments). Fortunately some nice people from Microsoft and SVC GmbH. in Austria have published a proof of concept for a Wcf SwA encoder. It does not have a fancy API yet and you would have to hard code your attachments in the encoder code itself. However it is a great start if you need such an interoperability.


What's next? get this blog rss updates or register for mail updates!