Click here to Skip to main content
11,490,408 members (34,806 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF
I am starting off with WCF and i am following the samples from MSDN. I managed to run the Getting Started sample on one machine as well as by deploying the client & service on separate machines and remotely accessing the service.

My goal is to implement the Publish/Subscribe design pattern. I have managed to run it on one machine without any big issues. But when i am deploying client & service on different machine, my client is unable to connect to the service. I get the following exception:

System.ServiceModel.Security.SecurityNegotiationException was unhandled
  Message=The caller was not authenticated by the service.
  Source=mscorlib

(I can share the stack trace if necessary)

Here are my configurations:

Service - web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <protocolMapping>
      <add scheme="http" binding="wsDualHttpBinding"/>
    </protocolMapping>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

Client - app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsDualHttpBinding>
        <binding name="WSDualHttpBinding_ISampleContract" clientBaseAddress="http://<SERVICE MACHINE PUBLIC IP>:8000/myClient/"
                 closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                  bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" />
          <security mode="Message">
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                algorithmSuite="Default"/>
          </security>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://<SERVICE MACHINE PUBLIC IP>/ServiceModelSamples/service.svc"
          binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_ISampleContract"
          contract="ISampleContract" name="WSDualHttpBinding_ISampleContract">
        <identity>
          <servicePrincipalName value="host/<SERVICE MACHINE PUBLIC IP>" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

I have searched for a solution but nothing has worked for me. I have tried to find a way to disable the security/authentication on the service side (just to get it work), but haven't been successful in that as well.

Any suggestions/solutions would be Hoping to get some positive feedback.

Regards.
Posted 11-Dec-12 8:36am
Comments
Programm3r at 12-Dec-12 5:46am
   
Hi - please have a look at the following: http://msdn.microsoft.com/en-us/library/system.servicemodel.httpclientcredentialtype.aspx

So your client is accessing the service over Internet? In such case you cannot use Windows security. It works only on local network / same Windows domain. (In this exception you should make security mode in both server and client None)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 570
1 Andy Lanng 233
2 OriginalGriff 188
3 Sascha Lefèvre 170
4 Maciej Los 160
0 Sergey Alexandrovich Kryukov 9,713
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,504
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100