[This is the sequel to Sharing objects between application instances (using .NET Remoting)]

Well, it took me some time to get back to this - there's a lot to read about WCF. And as I think this one will be mainly about WCF from now on, I've started a new thread about it.

After having read lots of stuff about WCF and getting an idea of what it can all do and a vague idea of how I make it doing that, I decided to first translate the "greetings" sample from A Developer's Introduction to Windows Communication Foundation 4 from C# to C++/CLI to use it as an easy toy for initial experiments:

Code:
// WcfTest1Server.cpp: Hauptprojektdatei.

// Translated from C# sample code at http://msdn.microsoft.com/en-us/library/ee354381.aspx

#include "stdafx.h"

#using "System.ServiceModel.dll"

using namespace System;
using namespace System::ServiceModel;
using namespace System::ServiceModel::Description;

[ServiceContract]
public interface class IHello
{
  [OperationContract]
  void SayHello(String ^name);
};

[ServiceContract]
public interface class IGoodbye
{
  [OperationContract]
  void SayGoodbye(String ^name);
};

public ref class GreetingService : public IHello, public IGoodbye  // Service implements both contracts
{
public:
  virtual void SayHello(String ^name)
  {
    Console::WriteLine("Hello {0}", name);
  }

  virtual void SayGoodbye(String ^name)
  {
    Console::WriteLine("Goodbye {0}", name);
  }
};

int main(array<System::String ^> ^args)
{
  // Host is configured with two base addresses, one for HTTP and one for TCP
  ServiceHost ^host = gcnew ServiceHost(GreetingService::typeid,
    gcnew Uri("http://localhost:8080/greeting"),
    gcnew Uri("net.tcp://localhost:8081/greeting"));
  host->Open();
  for each (ServiceEndpoint ^se in host->Description->Endpoints)
    Console::WriteLine("A: {0}, B: {1}, C: {2}", se->Address, se->Binding->Name, se->Contract->Name);
  Console::WriteLine("Press <Enter> to stop the service");
  Console::ReadLine();
  host->Close();
  return 0;
}
That was easy so far.

Difficulties started, however, when I tried to write a client for it, which I assumed not to be much more challenging either. And then it already took me some time to figure out that svcutil only accepts my server .exe as input if I compile it at least with the option /clr:pure instead of the mere /clr that gets set up by default by the IDE for a console app (unlike a Windows Forms app, BTW). (That does imply I can't use native code in a WPF service, doesn't it?)

Then, after I had the .h file generated by svcutil, I tried to compile my minimalistic client with that header. (I don't post the client code itself for now since I'm sure it's irrelevant: The compiler already stalls while processing the .h file.) I get a bunch of C3766 errors, telling me I'd better implement the add/remove accessors of the five events inherited from ICommunicationObject, like void System::ServiceModel::ICommunicationObject::Closed::add(System::EventHandler ^). I get these errors for the two client classes HelloClient and GoodbyeClient which derive from ClientBase<TChannel> with the respective interface as the type parameter.

However, according to MSDN, already ClientBase<TChannel> does implement them, yet these implementations are private. So what?

I renamed the header file from its original name schemas.microsoft.com.2003.10.Serialization.h, which I found too long and somehow looked to me like svcutil would name all these files like that anyway, to WcfTest1Client.h, but I don't think that can have such consequences, can it?

I'm confident I'll eventually figure this out, but there seems to be a considerable learning curve ahead. So, any help is appreciated.