【问题标题】:Delphi Soap WebServer doesn't allow more than 2 calls at a timeDelphi Soap WebServer 一次不允许超过 2 个调用
【发布时间】:2014-03-20 08:23:41
【问题描述】:

我的 SOAP WebServer 有问题:如果我在服务器上有一个方法需要几秒钟才能给出结果,并且我不能从我的“同时”(从线程调用)进行两次以上的调用客户端应用程序(也在 Delphi 中开发 - 仅用于测试,最终客户端应用程序将基于 Web)。我的意思是线程以某种方式被序列化,我不知道它是否应该像这样发生,或者我做错了什么,或者我是否需要进行某些设置。

Delphi XE2 Professional,Windows 7 64 位

链接到我的压缩项目: http://1drv.ms/Nwu9nY

服务器方法:

function TServiciu.Test: string;
var t0, t1, Duration : Cardinal;
    Guid : tguid;
    RGuid : HRESULT;
    received : boolean;
const MaxTime : Cardinal = 3000;
begin
  Result := '';
  RGuid := CreateGuid(Guid);
  if RGuid = S_OK then
    Result := GuidToString(Guid);
  t0 := GetTickCount;
  t1 := GetTickCount;
  duration := t1 - t0;
  while (Duration < Maxtime) do begin
    //waiting for something to be written in a db by another program
    //I am doing querys to the database for that result
    if received then begin
      Result := Result + '_RECEIVED_' + DateTimeToStr(Now);
      Break;
    end;
    t1 := GetTickCount;
    duration := t1 - t0;
    if duration > Maxtime then begin //MaxTime allowed is exceded
      Result := Result + '_NOTRECEIVED_' + DateTimeToStr(Now);
      Break;
    end;
  end;
end;

我的线程的客户端过程执行:

procedure TThreadTest.Execute;
begin
  try
    // OleCheck will raise an error if the call fails
    OleCheck(CoInitializeEx(NIL, COINIT_MULTITHREADED or COINIT_SPEED_OVER_MEMORY));
    try
      s := 'Calling Method Test; Result=' +
      Self.ThGetService.Test;
      Synchronize(self.ScrieRezultat); //write result in memo
    finally
      CoUninitialize;
      FreeAndNil(self.ThHttprio);
    end;
  except
    // We failed, do something
  end;
end;

【问题讨论】:

    标签: delphi soap delphi-xe2 soap-client


    【解决方案1】:

    我能够毫无问题地处理 40 个并发呼叫(实际上不止于此),但我使用的是不同的方法。我的服务是 CGI 可执行文件,因此 IIS 管理连接。当发出 SOAP 请求时,IIS 会启动一个新的 myapp_cgi.exe 实例来处理请求。我最高可以达到 40 TPS,但我在 4 台服务器之间进行了负载平衡,因此我实际上可以做到 160 TPS,如果需要的话,可以持续一整天。

    【讨论】:

      【解决方案2】:

      您好,我解决了我的问题,这件事很愚蠢,我将服务器设置为 HTTP 1.1。 与单个 HTTP 1.1 服务器的连接仅限于两个同时连接。 http://support2.microsoft.com/kb/183110

      【讨论】:

      • @mjn - 你好,我更新了链接。谢谢你的信息。
      【解决方案3】:

      我刚刚遇到了一个非常相似的问题,我很确定您的问题出在您的客户端上,而不是在您的服务器上。 见this topic here.

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-10-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-28
        • 1970-01-01
        相关资源
        最近更新 更多