I am trying to access my WCF service on a server from my client console application for testing. I am getting the following error:
The caller was not authenticated by the service
I am using wsHttpBinding
. I'm not sure what kind of authentication the service is expecting?
<behaviors>
<serviceBehaviors>
<behavior name="MyTrakerService.MyTrakerServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
Update
It works if I change my binding to <endpoint "basicHttpBinding" ... />
(from wsHttpBinding)
on the IIS 7.0 hosted, windows 2008 server
if needed to specify domain(which authecticates username and password that client uses) in webconfig you can put this in system.serviceModel services service section:
and in client specify domain and username and password:
This can be caused if the client is in a different domain than the server.
I encountered this when testing one of my applications from my PC(client) to my (cloud) testing server and the simplest solution i could think of was setting up a vpn.
We ran into a weird issue where the folder where the WCF service was being hosted from had some permissions that were causing the problem.
If you're using a self hosted site like me, the way to avoid this problem (as described above) is to stipulate on both the host and client side that the wsHttpBinding security mode = NONE.
When creating the binding, both on the client and the host, you can use this code:
or
I got it.
If you want to use wshttpbinding, u need to add windows credentials as below.
thanks
If you use basicHttpBinding, configure the endpoint security to "None" and transport clientCredintialType to "None."
Also, make sure the directory Authentication Methods in IIS to Enable Anonymous access