title: Calling Net Tcp WCF Service from Claims based SharePoint
body: <p>I have a windows service that runs a WCF Net Tcp binding service. All binding and endpoint information is set programmatically.</p>
  
  <pre><code>_host.AddServiceEndpoint(typeof(IService), new NetTcpBinding(), serviceName);
  </code></pre>
  
  <p>In sharepoint I am accessing this service using a channel factory:</p>
  
  <pre><code>var channelFactory = new ChannelFactory&lt;IService&gt;(
    new NetTcpBinding(),
    new EndpointAddress(new Uri(connectionUrl))
  );
   return channelFactory.CreateChannel();
  </code></pre>
  
  <p>This code ran fine using SharePoint 2007. Now that we are upgrading our SharePoint site to 2010 the new forms based claims identity is not sending client credentials. I get this error.</p>
  
  <pre><code>System.IdentityModel.Tokens.SecurityTokenValidationException, System.IdentityModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  The service does not allow you to log on anonymously.
  </code></pre>
  
  <p>Does anyone know how I can get the Channel Factory to send the application pool's credentials? Right now I have solved my issue by using RunWithElevatedPrivileges but I'm not really keen on doing that unless I do not have any other choice.</p>