title: hosting WCF service in IIS with windows authentication and without anonymous access
body: <p>I would like to use WCF service hosted in IIS (5/6) with integrated windows authentication enabled and anonymous access disabled. I tried to do this by following <a href="http://msdn.microsoft.com/en-us/library/ff648431.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ff648431.aspx</a>, but getting an error saying certificate is not installed.  But I don't need SSL. I don't have any clients expecting older ASMX services, so I don't need to use basicHttpBinding (and also it is not secure), so I tried to use wsHttpBinding. </p>
  
  <p>How do I get wsHttpBinding with windows authentication to work without SSL? This is such a common requirement, but I couldn't find any solution for this. Can someone post the configuration for the client and the server please? I am using ASP.NET client.</p>
  
  <p>My configuration below. and the exact error message is:</p>
  
  <blockquote>
    <p>An error occurred while making the HTTP request to
    <a href="https://mymachine/WCFTest/Service1.svc" rel="nofollow">https://mymachine/WCFTest/Service1.svc</a>. This could be due to the fact
    that the server certificate is not configured properly with HTTP.SYS
    in the HTTPS case. This could also be caused by a mismatch of the
    security binding between the client and the server.</p>
  </blockquote>
  
  <p>I used "svcUtil" utility to generate the proxy class and configuration for the client.</p>
  
  <pre><code>server:
      &lt;system.serviceModel&gt;
          &lt;bindings&gt;
              &lt;wsHttpBinding&gt;
                  &lt;binding name="wsHttpEndpointBinding"&gt;
                      &lt;security mode="Transport"/&gt;
                  &lt;/binding&gt;
              &lt;/wsHttpBinding&gt;
          &lt;/bindings&gt;
          &lt;services&gt;
              &lt;service behaviorConfiguration="WCFTest.Service1Behavior" name="WCFTest.Service1"&gt;
                  &lt;endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" name="wsHttpEndpoint" contract="WCFTest.IService1"/&gt;
              &lt;/service&gt;
          &lt;/services&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior name="WCFTest.Service1Behavior"&gt;
                      &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
                      &lt;serviceMetadata httpGetEnabled="true"/&gt;
                      &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
                      &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
          &lt;/behaviors&gt;
      &lt;/system.serviceModel&gt;
  
  client:
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;wsHttpBinding&gt;
          &lt;binding name="wsHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
              receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
              transactionFlow="false" hostNameComparisonMode="StrongWildcard"
              maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
              messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
              allowCookies="false"&gt;
            &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
            &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"
                enabled="false" /&gt;
            &lt;security mode="Transport"&gt;
              &lt;transport clientCredentialType="Windows" proxyCredentialType="None"
                  realm="" /&gt;
              &lt;message clientCredentialType="Windows" negotiateServiceCredential="true"
                  establishSecurityContext="true" /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/wsHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
        &lt;endpoint address="https://mymachine/WCFTest/Service1.svc"
            binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint"
            contract="IService1" name="wsHttpEndpoint"&gt;
          &lt;identity&gt;
            &lt;userPrincipalName value="mymachine\ASPNET" /&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
      &lt;/client&gt;
    &lt;/system.serviceModel&gt; 
  </code></pre>