Error when creating TRESTClient: “No peer with the interface with guid [{}] has been registered”

元气小坏坏 提交于 2019-12-02 00:35:40

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!