views:

17036

answers:

10

Hi,

Trying to access my WCF on a server from my client console application for testing.

I am getting the error: The caller was not authenticated by the service

I am using wsHttpBinding. I'm not sure what kind of authenicating it 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 (from wsHttpBinding) IIS 7.0 hosted, windows 2008 server

+1  A: 

Have you tried using basicHttpBinding instead of wsHttpBinding? If do not need any authentication and the Ws-* implementations are not required, you'd probably be better off with plain old basicHttpBinding. WsHttpBinding implements WS-Security for message security and authentication.

RandomNoob
This worked for me, thanks a bunch.
John Leidegren
+6  A: 

If you use basicHttpBinding, configure the endpoint security to "None" and transport clientCredintialType to "None."

<bindings>
    <basicHttpBinding>
        <binding name="MyBasicHttpBinding">
            <security mode="None">
                <transport clientCredentialType="None" />
            </security>
        </binding>
    </basicHttpBinding>
</bindings>
<services>
    <service behaviorConfiguration="MyServiceBehavior" name="MyService">
        <endpoint 
            binding="basicHttpBinding" 
            bindingConfiguration="MyBasicHttpBinding"
            name="basicEndPoint"    
            contract="IMyService" 
        />
</service>

Also, make sure the directory Authentication Methods in IIS to Enable Anonymous access

Michael Kniskern
A: 

Thank you very much. It has worked for me.

I was publishing web services but I didn't need any security so changing to basicHttpBinding in client and host has worked.

A: 

Thanks a lot. That works for me as well. If you can provide solution for wsHttpBinding, that will be great. Because in the nearest future, I will have to implement security on my wcf web service.

thanks in advance.

+4  A: 

I got it.

If you want to use wshttpbinding, u need to add windows credentials as below.

svc.ClientCredentials.Windows.ClientCredential.UserName = "abc"; svc.ClientCredentials.Windows.ClientCredential.Password = "xxx";

thanks

And you may need the Domain too (.ClientCredentials.Windows.ClientCredential.Domain)
Retne
A: 

I got it.

If you want to use wshttpbinding, u need to add windows credentials as below.

svc.ClientCredentials.Windows.ClientCredential.UserName = "abc"; svc.ClientCredentials.Windows.ClientCredential.Password = "xxx";

thanks

A: 

Can we set the same setting in Web.config

svc.ClientCredentials.Windows.ClientCredential.UserName = "abc"; svc.ClientCredentials.Windows.ClientCredential.Password = "xxx"; how to do that

A: 

solution for The caller was not authenticated by the service for wsHttPBinding.

set anonymous access in your virtual directory

write following credentials to your service

ADTService.ServiceClient adtService = new ADTService.ServiceClient(); adtService.ClientCredentials.Windows.ClientCredential.UserName="windowsuseraccountname" adtService.ClientCredentials.Windows.ClientCredential.UserName="windowsuseraccountpassword"

after that you call your webservice methods

Thanks, kishore.chokkapu St.Croix Systems

kishore
A: 

why cant you just remove the security setting all together for wsHttpBinding

securitymode="node" instead of "message" or "transport"

Can Bilgin
A: 

We set the security mode to make it secure while publishing the services to the internet. If you set security mode to none which is very insane, then your application likely opened to everyone.

m.ar13f
He clearly states that this is for testing. If he had something like this in production he would be opening up to all the internet. That may be insane, or it may be what he wants to do. Regardless, it is irrelevant as this is not production-setup.
Tomas