Bla*_*man 25 .net c# wcf windows-services
我有一个WCF服务,我从Windows服务调用.
WCF服务运行一个SSIS包,该包可能需要一段时间才能完成,我不希望我的Windows服务必须等待它完成.
如何使我的WCF服务调用异步?(或者它是默认的异步?)
Bah*_*mut 13
在Visual Studio 2010上的Add Service Reference > click Advanced button > check the Generate Asynchronous Operations复选框上.
执行此操作后,将添加Async操作并供您使用.
服务方面:
[ServiceContract]
public interface IMyService
{
    [OperationContract]
    bool DoWork(int i);
}
客户端:
[ServiceContract(Name = nameof(IMyService))]
public interface IMyServiceClient : IMyService
{
    [OperationContract]
    Task<bool> DoWorkAsync(int i);
}
| 归档时间: | 
 | 
| 查看次数: | 59108 次 | 
| 最近记录: |