title: Accessing SelfHosted WCF Services outside a domain
body: <p>We have WCF services being self-hosted by a Windows Service inside our domain, using NetTCP with the following settings.</p>
  
  <pre><code>// Set Binding Security.
  netTcpBinding.Security.Mode = SecurityMode.Transport;
  netTcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
  netTcpBinding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
  </code></pre>
  
  <p>We now have a requirement to allow people outside the domain to access these Services (as long as they can provide proper domain credentials).  Our goal isn't to host the services via IIS, just allow those outside folks into our services.  In my testing I was able to connect to a service from outside by "impersonating" the client proxy credentials during the WCF call as such.</p>
  
  <pre><code>proxy.ClientCredentials.Windows.ClientCredential.Domain = "MyDomainName";
  proxy.ClientCredentials.Windows.ClientCredential.UserName = "MyUserName";
  proxy.ClientCredentials.Windows.ClientCredential.Password = "MyPassword";
  </code></pre>
  
  <p>My question is: Is this the correct way?  Is there a better way?  Any advice would be greatly appreciated.</p>