none
The service certificate is not provided. Specify a service certificate in ServiceCredentials. RRS feed

  • Question

  • I have read a few threads/articles on this error but need a little more guidance in case im doing something wrong....Running Win 8 Pro.

    I have a WCF service created. I then installed IIS and created a self signed Cert and have exported it as a .CER file type. When i browse to the service i get the error "

    The service certificate is not provided. Specify a service certificate in ServiceCredentials.

    "

    My config file looks like this but i cant seem to get past the error?

    <?xml version="1.0"?>
    <configuration>
     
      <system.diagnostics>
        <sources>
          <source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                <filter type="" />
              </add>
            </listeners>
          </source>
        </sources>
      </system.diagnostics>
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="false" strict="false" explicit="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
        <pages>
          <namespaces>
            <add namespace="System.Runtime.Serialization" />
            <add namespace="System.ServiceModel" />
            <add namespace="System.ServiceModel.Web" />
          </namespaces>
        </pages>
      </system.web>
      <system.serviceModel>
        <services>
          <service name="TechnologyService">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WsBinding"
              contract="ITechnology">
              <identity>
                <dns value="MyServiceCert" />
              </identity>
            </endpoint>
          </service>
        </services>
        <bindings>
          <wsHttpBinding>
            <binding name="WsBinding">
              <security>
                <message clientCredentialType="UserName" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <diagnostics>
          <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
        </diagnostics>
        <behaviors>
          <serviceBehaviors>
            <behavior name="">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
            <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>    
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="true"/>
      </system.webServer>
     
    </configuration>
    

    Thursday, October 3, 2013 7:26 PM

Answers

  • Hi Pure,

    As shown in the error message, you need specify a service certificate in ServiceCredentials, something like:

    <service name="TechnologyService" behaviorConfiguration="serviceCertificateBehavior">
         <endpoint ... />
        </service>
    
    ...
    <serviceBehaviors>
     <behavior name="serviceCertificateBehavior">
    <serviceCredentials>
     <serviceCertificate storeLocation="..." storeName=".."  
    x509FindType="FindBySubjectName" findValue="certificate_name" />
           </serviceCredentials>
          </behavior>
        </serviceBehaviors>
    

    For test purpose, you can set clientCredentialType="None" to allow anonymous clients, to test if the service works. You need also specify a SecurityMode for the binding. There are some reference for your information.

    #Nine simple steps to enable X.509 certificates on WCF

    http://www.codeproject.com/Articles/36683/9-simple-steps-to-enable-X-509-certificates-on-WCF

    http://www.youtube.com/watch?v=yytRjxBNscA

    Best Regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, October 4, 2013 6:10 AM
    Moderator