I'm not experienced with WCF Service in general (this is my 1'st attempt to create, configure and consume WCF Service).
- I've created my WCF Service, tested it through WCF Test Client (on Development PC "in" Visual Studio) and everything was working.
- 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.
- 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".
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?
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.
Is there something I'm missing?
Web.config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="TestWCF.TestServis">
<endpoint address="TestWCF" binding="wsHttpBinding" contract="TestWCF.ITestServis" />
</service>
<service name="TestWCF.TestPushingServis">
<endpoint address="" binding="webHttpBinding" contract="TestWCF.ITestPushingServis" behaviorConfiguration="web" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- 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 -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!-- 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. -->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
Application.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ITestServis"
maxReceivedMessageSize="2147483647" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://testdomain.com:12345/TestServis.svc/TestWCF"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ITestServis"
contract="TestServisReference.ITestServis"
name="WSHttpBinding_ITestServis">
<identity>
<servicePrincipalName value="host/ServerName" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>