title: Unable to Connect to Remote WCF Service - SecurityNegotiationException
body: <p>I am starting off with <a href="http://en.wikipedia.org/wiki/Windows_Communication_Foundation" rel="nofollow">WCF</a>, and I am following <a href="http://msdn.microsoft.com/en-us/library/dd483346.aspx" rel="nofollow">the samples from MSDN</a>. I managed to run the Getting Started sample on one machine as well as by deploying the client &amp; service on separate machines and remotely accessing the service.</p>
  
  <p>My goal is to implement the <a href="http://msdn.microsoft.com/en-us/library/ms752254.aspx" rel="nofollow">Publish/Subscribe design pattern</a>. I have managed to run it on one machine without any big issues. But when I am deploying client &amp; service on different machine, my client is unable to connect to the service. I get the following exception:</p>
  
  <pre><code>System.ServiceModel.Security.SecurityNegotiationException was unhandled
    Message=The caller was not authenticated by the service.
    Source=mscorlib
  </code></pre>
  
  <p>(I can share the stack trace if necessary.)</p>
  
  <p>Here are my configurations:</p>
  
  <p><strong>Service - web.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;protocolMapping&gt;
        &lt;add scheme="http" binding="wsDualHttpBinding"/&gt;
      &lt;/protocolMapping&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;serviceMetadata httpGetEnabled="True"/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><strong>Client - app.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;wsDualHttpBinding&gt;
          &lt;binding name="WSDualHttpBinding_ISampleContract" clientBaseAddress="http://&lt;SERVICE MACHINE PUBLIC IP&gt;:8000/myClient/"
                   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"&gt;
            &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
            &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" /&gt;
            &lt;security mode="Message"&gt;
              &lt;message clientCredentialType="Windows" negotiateServiceCredential="true"
                  algorithmSuite="Default"/&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/wsDualHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
        &lt;endpoint address="http://&lt;SERVICE MACHINE PUBLIC IP&gt;/ServiceModelSamples/service.svc"
            binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_ISampleContract"
            contract="ISampleContract" name="WSDualHttpBinding_ISampleContract"&gt;
          &lt;identity&gt;
            &lt;servicePrincipalName value="host/&lt;SERVICE MACHINE PUBLIC IP&gt;" /&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
      &lt;/client&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I have searched for a solution, but nothing has worked for me. I have tried to find a way to disable the security/authentication on the service side (just to get it work), but haven't been successful in that as well.</p>
  
  <p>How can I fix this?</p>