当前位置 : 主页 > 编程语言 > delphi >

创建TRESTClient时出错:“没有注册带有guid [{}]的接口的对等体”

来源:互联网 收集:自由互联 发布时间:2021-06-23
我已经创建了我的类来使用REST.我在运行时遇到TRESTClient组件的问题. TFrwWebServiceREST = class(TInterfacedObject, IRESTWebServiceProxy)private FClientRest: TRESTClient; FRequestRest: TRESTRequest; FResponseRest: TRESTR
我已经创建了我的类来使用REST.我在运行时遇到TRESTClient组件的问题.

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;

错误并不总是发生…该过程完美地运行,然后一段时间后,此错误开始发生.

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’.

创建RESTClient时会引发异常.它能是什么?

有必要将IPPeerClient包含在客户端代码中的“uses”子句中,并将IPPeerServer包含在服务器代码中的“uses”子句中,请参阅
http://blogs.embarcadero.com/pawelglowacki/2013/01/10/39958
网友评论