Hi there,

I'm trying to make my WCF application accept HTTPS connection, but it
just won't let me connect to the service.
Here's a snippet of the code I use to generate a (valid...?) .cer file

===== CODE =====
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = localPath + "makecert.exe";
proc.StartInfo.Arguments = "-r -pe -n \"CN=www.toto.com\" -b
01/01/2000 -e 01/01/2036 -ss my -sr localmachine -sky exchange -sp
\"Microsoft RSA SChannel Cryptographic Provider\" -sy 12";
===== END CODE =====

1rst question: is it an acceptable way to generate the certificate ?
Am I missing some vital information ?

And now, a snippet of the code I use to create my ServiceHost:

===== CODE =====
baseAddress = string.Format("https://{0}.{1}:{2}";,
System.Environment.MachineName, domainName, this.tcpPort);
this.host = new ServiceHost(typeof(MySpace.WebServices), new Uri[]
{ new Uri(baseAddress + "/WebServices") });
BasicHttpBinding binding = new BasicHttpBinding
(BasicHttpSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType =
HttpClientCredentialType.None;

ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
behavior.HttpsGetEnabled = true;
host.Description.Behaviors.Add(behavior);

host.AddServiceEndpoint(typeof(IMyInterface), binding, baseAddress + "/
WebServices");
this.host.Credentials.ServiceCertificate.SetCertificate
(StoreLocation.LocalMachine, StoreName.My,
X509FindType.FindByIssuerName, "www.toto.com");
this.host.Open();
===== END CODE =====

The service starts with no errors, but when I try to connect I get the
following from Firefox : "Data transfer interrupted"

What am I doing wrong ?

Thanks in advance

Reply via email to