问题
I've created my class to work with REST. I have a problem with TRESTClient component in runtime.
TFrwWebServiceREST = class(TInterfacedObject, IRESTWebServiceProxy)
private
FClientRest: TRESTClient;
FRequestRest: TRESTRequest;
FResponseRest: TRESTResponse;
public
constructor Create (AUrl: string); virtual;
end;
...
constructor TFrwWebServiceREST.Create(AUrl: string);
begin
FClientRest := TRESTClient.Create (AUrl); //the error occurs here
FClientRest.AcceptEncoding := 'UTF-8';
FResponseRest := TRESTResponse.Create (nil);
FResponseRest.ContentEncoding := 'UTF-8';
FRequestRest := TRESTRequest.Create (nil);
FRequestRest.AcceptEncoding := 'UTF-8';
FRequestRest.Response := FResponseRest;
FRequestRest.Client := FClientRest;
end;
The error does not always occur ... The process works perfectly, and then after a while, this error starts to occur.
First chance exception at $7656C54F. Exception class EIPAbstractError with message 'No peer with the interface with guid {B8BD5BD8-C39D-4DF1-BB14-625FC86029DB} has been registered'.
The exception is raised when creating the RESTClient. What can it be?
回答1:
It's necessary to include IPPeerClient to the interface "uses" clause in your client code and to include IPPeerServer to the interface "uses" clause in your server code, please see http://blogs.embarcadero.com/pawelglowacki/2013/01/10/39958
来源:https://stackoverflow.com/questions/39747533/error-when-creating-trestclient-no-peer-with-the-interface-with-guid-has