WCF Service and Threading

后端 未结 4 1550
庸人自扰
庸人自扰 2021-01-02 11:21

I have created a simple WCF (.NET 3.5) service which defines 10 contracts which are basically calculations on the supplied data. At the moment I expect quite few clients to

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-02 11:56

    I'm not familiar with WCF, but can the process be async? If you are expecting a huge amount of data and intensive calculations, one option could be to send an id, calculate the values in a separate thread and then provide a method to return the result using the initial id.

    Something like:

     int id = Service.CalculateX(...);
     ...
     var y = Service.GetResultX(id);
    

提交回复
热议问题