title: WCF Duplex - Client is unable to finish the security negotiation within the configured timeout
body: <p>I have a duplex WCF, it work perfect in local host (connect my application to this WCF when it run locally).</p>
  
  <p>Now I tried to hosted it in my IIS (Server 2008 R2 standard), I create a windows account "GOD", and an application poll in IIS using the "GOD" identity.</p>
  
  <p>I can access this WCF from my pc (other than the server) from web browser and see the XML of the contract, (click on the link inside the page displayed)</p>
  
  <p>When try to access from my application I get the exception:</p>
  
  <blockquote>
    <p>Client is unable to finish the security negotiation within the
    configured timeout (00:00:00).  The current negotiation leg is 1
    (00:00:00).</p>
  </blockquote>
  
  <p>Again when the WCF run locally my app work OK.</p>
  
  <p>I tried to use the trace but all I successful to see is the exception about the time out.</p>
  
  <p>My app.config is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;system.diagnostics&gt;
      &lt;sources&gt;
        &lt;source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"&gt;
          &lt;listeners&gt;
            &lt;add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces.svclog"/&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
      &lt;/sources&gt;
    &lt;/system.diagnostics&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;wsDualHttpBinding&gt;
          &lt;binding name="WSDualHttpBinding_I_BridgeWCFService" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"&gt;
            &lt;readerQuotas maxDepth="256" maxStringContentLength="2147483646"
              maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" /&gt;
            &lt;reliableSession ordered="true" inactivityTimeout="01:10:00" /&gt;
            &lt;security mode="Message" /&gt;
          &lt;/binding&gt;
        &lt;/wsDualHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
        &lt;endpoint address="http://win-jj/_Bridge1/_BridgeWcfService.svc"
          binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_I_BridgeWCFService"
          contract="_BridgeWcfServiceReference.I_BridgeWCFService"
          name="WSDualHttpBinding_I_BridgeWCFService"&gt;
          &lt;identity&gt;
            &lt;dns value="localhost"/&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
      &lt;/client&gt;
    &lt;/system.serviceModel&gt;
    &lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/&gt;
    &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I also tried to change the identity section above to: <code>&lt;userPrincipalName value="GOD" /&gt;</code>, but then I got another exception.</p>
  
  <p>My service config file: web.config:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;wsDualHttpBinding&gt;
          &lt;binding name="WSDualHttpBinding_I_BridgeWCFService" closeTimeout="01:01:00" openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"&gt;
            &lt;readerQuotas maxDepth="256" maxStringContentLength="2147483646" maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646"/&gt;
            &lt;reliableSession ordered="true" inactivityTimeout="01: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;services&gt;
        &lt;service behaviorConfiguration="_BridgeNameSpace.Service1Behavior" name="_BridgeNameSpace._BridgeWCFService"&gt;
          &lt;endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_I_BridgeWCFService" contract="_BridgeNameSpace.I_BridgeWCFService"&gt;
            &lt;identity&gt;
              &lt;userPrincipalName value="GOD" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="_BridgeNameSpace.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;dataContractSerializer maxItemsInObjectGraph="2147483647"/&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;
    &lt;system.web&gt;
      &lt;compilation debug="true"/&gt;
    &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I also tried to change the identity section above to: <code>&lt;dns value="localhost"/&gt;</code>, but nothing change</p>
  
  <p>I connect to my service in my application as following:</p>
  
  <pre><code>MyServiceClientProxy Proxy = null;
  MyCallbackProxy myCallbackProxy = null;
  
  myCallbackProxy = new MyCallbackProxy();
  InstanceContext cntx = new InstanceContext(myCallbackProxy);
  Proxy = new MyServiceClientProxy(cntx, "WSDualHttpBinding_I_BridgeWCFService");
  Proxy.ClientCredentials.Windows.ClientCredential.UserName = "GOD";
  Proxy.ClientCredentials.Windows.ClientCredential.Password = "yy";
  try
  {
  Proxy.Open();
  }
  catch { return; }
  </code></pre>
  
  <p>BTW, when tried to change the security to '' got the following exception (wither or not use the ClientCredential.Username&amp;Password as the code above):</p>
  
  <pre><code>The open operation did not complete within the allotted timeout of 00:00:59.1689524. The time allotted to this operation may have been a portion of a longer timeout.
  </code></pre>
  
  <p>ANY IDEA ?, PLS help!</p>