title: How to configure WCF Service with wsHttpBinding hosted on IIS and consumable over Web?
body: <p>I'm not experienced with WCF Service in general (this is my 1'st attempt to create, configure and consume WCF Service).</p>
  
  <ol>
  <li>I've created my WCF Service, tested it through WCF Test Client (on Development PC "in" Visual Studio) and everything was working.</li>
  <li>I've hosted it in IIS on our Server (not Development PC) adding it to ASP.Net v4.0 Application Pool, tested it with Windows Forms Application (from Development PC) in which I've added Service Reference to hosted WCF Service and everything was working.</li>
  <li>I've tried same application (and application.config) from my Home PC and I'm getting this error: "The caller was not authenticated by the service".</li>
  </ol>
  
  <p>I've tried to "Google it" and most said that error is caused by computers on different Domain (which is expected because my Home PC and Server at Work aren't even on the same network), but I presume that WCF is consumable over Web or am I presuming wrong?</p>
  
  <p><code>On Development PC, WCF Service address is redirected to Local IP of Server PC. I've also added REST/Web Service because I need to POST some data and it's consumable without any problems.</code></p>
  
  <p>Is there something I'm missing?</p>
  
  <p><strong>Web.config:</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
  
    &lt;appSettings&gt;
      &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt;
    &lt;/appSettings&gt;
  
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5"/&gt;
    &lt;/system.web&gt;
  
    &lt;system.serviceModel&gt;
  
      &lt;services&gt;
          &lt;service name="TestWCF.TestServis"&gt;
              &lt;endpoint address="TestWCF" binding="wsHttpBinding" contract="TestWCF.ITestServis" /&gt;
          &lt;/service&gt;
  
          &lt;service name="TestWCF.TestPushingServis"&gt;
              &lt;endpoint address="" binding="webHttpBinding" contract="TestWCF.ITestPushingServis" behaviorConfiguration="web" /&gt;
          &lt;/service&gt;
      &lt;/services&gt;
  
      &lt;behaviors&gt;
  
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/&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="true"/&gt;
          &lt;/behavior&gt;     
        &lt;/serviceBehaviors&gt;
  
        &lt;endpointBehaviors&gt;
          &lt;behavior name="web"&gt;
              &lt;webHttp /&gt;
          &lt;/behavior&gt;
        &lt;/endpointBehaviors&gt;
  
      &lt;/behaviors&gt;
  
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt;
    &lt;/system.serviceModel&gt;
  
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;!-- To browse web app root directory during debugging, set the value below to true. Set to false before deployment to avoid disclosing web app folder information. --&gt;
      &lt;directoryBrowse enabled="true"/&gt;
    &lt;/system.webServer&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p><strong>Application.config:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
      &lt;/configSections&gt;
      &lt;startup&gt; 
          &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt;
      &lt;/startup&gt;
      &lt;system.serviceModel&gt;
          &lt;bindings&gt;
              &lt;wsHttpBinding&gt;
                  &lt;binding name="WSHttpBinding_ITestServis"
                           maxReceivedMessageSize="2147483647" /&gt;
              &lt;/wsHttpBinding&gt;
          &lt;/bindings&gt;
          &lt;client&gt;
              &lt;endpoint address="http://testdomain.com:12345/TestServis.svc/TestWCF"
                  binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ITestServis"
                  contract="TestServisReference.ITestServis"
                  name="WSHttpBinding_ITestServis"&gt;
                  &lt;identity&gt;
                      &lt;servicePrincipalName value="host/ServerName" /&gt;
                  &lt;/identity&gt;
              &lt;/endpoint&gt;
          &lt;/client&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>