WCF Client (programmatisch)



  • Ich möchte einen WCF Client ohne den Weg über eine app.config gehen, d.h. alle nötigen Informationen sollen im Code stehen.

    Mein aktueller Code:

    XYServiceChannel^ channel = ChannelFactory<XYServiceChannel^ >::CreateChannel(
            gcnew BasicHttpBinding(),
            gcnew EndpointAddress("http://host/Component/XYService")
    );
    
    Response^ response = channel->getXY(gcnew getRequest());
    

    Bei Aufruf der Methode getXY() bekomme ich jedoch die Fehlermeldung:
    *
    Eine nicht behandelte Ausnahme des Typs "System.ServiceModel.FaultException" ist in mscorlib.dll aufgetreten.

    Zusätzliche Informationen: The endpoint reference (EPR) for the Operation not found is http://host/Component/XYService and the WSA Action =
    *

    Was muss ich ändern, damit der Aufruf klappt?
    Mit einer app.config, in der die bindings, endpoint etc. gesetzt sind, klappt der Aufruf ohne Probleme.


Anmelden zum Antworten