title: How to avoid CommunicationObjectFaultedException when hosting a WCF service in IIS?
body: <p>After creating a <a href="http://msdn.microsoft.com/en-us/library/ms733766.aspx" rel="nofollow noreferrer">WCF Web Service for IIS</a> and sucessfully testing it in my ASP.NET development server, when I deploy the service to <em>another machine's</em> IIS it always fire the following exception on consumption:</p>
  
  <blockquote>
    <p>Test method PoolingServiceTest.ProgramTest.MainTaskTest threw exception:  System.ServiceModel.CommunicationObjectFaultedException: O objeto de comunicação, System.ServiceModel.Channels.ServiceChannel, não pode ser usado para comunicação porque está no estado Com Falha..</p>
  </blockquote>
  
  <p>In English: The object cannot be used for communication because it is With Fault (faulted)</p>
  
  <p>Stack trace</p>
  
  <blockquote>
    <p>System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
    System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
    System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
    System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
    Close()
    System.IDisposable.Dispose()</p>
  </blockquote>
  
  <p>What can I do to avoid this?</p>
  
  <p>With a try catch block surrounding the client code I got a different exception:</p>
  
  <blockquote>
    <p>[System.ServiceModel.Security.SecurityNegotiationException]   {"O chamador não foi autenticado pelo serviço."}    System.ServiceModel.Security.SecurityNegotiationException</p>
  </blockquote>
  
  <p>In English: The caller wasn't authenticated by the service</p>