Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6963385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:47:01+00:00 2026-05-27T15:47:01+00:00

I am attempting to host a service that serves up basic web content (HTML,

  • 0

I am attempting to host a service that serves up basic web content (HTML, javascript, json) using a WebHttpBinding with minimal administrator involvement.

Thus far I have been successful, the only admin priviledges necessary are at install time (register the http reservation for the service account and to create the service itself). However, now I am running into issues with SSL. Ideally I would like to support a certificate outside the windows certificate store. I found this article – http://www.codeproject.com/KB/WCF/wcfcertificates.aspx – which seems to indicate you can specify the certificate on the service host, however at runtime navigating a browser to https://localhost/Dev/MyService results in a 404.

[ServiceContract]
public interface IWhoAmIService
{
    [OperationContract]
    [WebInvoke(
        Method = "GET",
        UriTemplate = "/")]
    Stream WhoAmI();
}

public class WhoAmIService : IWhoAmIService
{
    public Stream WhoAmI()
    {
        string html = "<html><head><title>Hello, world!</title></head><body><p>Hello from {0}</p></body></html>";
        html = string.Format(html, WindowsIdentity.GetCurrent().Name);

        WebOperationContext.Current.OutgoingResponse.ContentType = "text/html";

        return new MemoryStream(Encoding.UTF8.GetBytes(html));
    }
}

static void Main(string[] args)
{
    ServiceHost host = new ServiceHost(typeof(WhoAmIService), new Uri("https://localhost:443/Dev/WhoAmI"));
    host.Credentials.ServiceCertificate.Certificate = new X509Certificate2(@"D:\dev\Server.pfx", "private");

    WebHttpBehavior behvior = new WebHttpBehavior();
    behvior.DefaultBodyStyle = WebMessageBodyStyle.Bare;
    behvior.DefaultOutgoingResponseFormat = WebMessageFormat.Json;
    behvior.AutomaticFormatSelectionEnabled = false;

    WebHttpBinding secureBinding = new WebHttpBinding();
    secureBinding.Security.Mode = WebHttpSecurityMode.Transport;
    secureBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;

    ServiceEndpoint secureEndpoint = host.AddServiceEndpoint(typeof(IWhoAmIService), secureBinding, "");
    secureEndpoint.Behaviors.Add(behvior);

    host.Open();
    Console.WriteLine("Press enter to exit...");
    Console.ReadLine();
    host.Close();
}

If I change my binding security to none and the base uri to start with http, it serves up okay. This post seems to indicate that an additional command needs to be executed to register a certificate with a port with netsh (http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/6907d765-7d4c-48e8-9e29-3ac5b4b9c405/). When I try this, it fails with some obscure error (1312).

C:\Windows\system32>netsh http add sslcert ipport=0.0.0.0:443 certhash=0b740a29f
29f2cc795bf4f8730b83f303f26a6d5 appid={00112233-4455-6677-8899-AABBCCDDEEFF}

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

How can I host this service using HTTPS without the Windows Certificate Store?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:47:02+00:00Added an answer on May 27, 2026 at 3:47 pm

    It is not possible. HTTPS is provided on OS level (http.sys kernel driver) – it is the same as providing HTTP reservation and OS level demands certificate in certificate store. You must use netsh to assign the certificate to selected port and allow accessing the private key.

    The article uses certificates from files because it doesn’t use HTTPS. It uses message security and message security is not possible (unless you develop your own non-interoperable) with REST services and webHttpBinding.

    The only way to make this work with HTTPS is not using built-in HTTP processing dependent on http.sys = you will either have to implement whole HTTP yourselves and prepare new HTTP channel for WCF or you will have to find such implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I'm attempting to write a Junit test that calls a Web Service client
I've written a web service using ASP.NET (in C#) and I'm attempting to write
I'm attempting to host a web browser inside a dialog. I am using C++
I am attempting to create and host a simple RESTful WCF Service. The service
I'v been attempting to configure my WCF service to expose both SOAP and Json
I'm trying to host a WCF service in IIS7 that works with both Silverlight
I'm attempting to do basic auth with Apache HTTPClient 4.x using the example from
I have a WCF REST web service that is hosted via a service route
I'm running Windows 7 64-bit. I'm attempting to host a WCF service which will
I am having a problem when attempting to host a UserControl as Tab Content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.