1

我有一个服务 WCF 接口:

[ServiceContract(Namespace = "net.pipe://QFX_DLL/TradingService")]
public interface IGenericTradingInterface  {

    [OperationContract]
    void GetServerInformation(out ServerAttributes attributes);
}

主机已启动并正常运行。我使用 svcutil 创建客户端代理对象,如下所示:

svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config net.pipe://localhost/QFX_DLL/mex /async /tcv:Version35

为异步调用生成的代理如下所示:

public void GetServerInformationAsync()
{
    this.GetServerInformationAsync(null);
}

如您所见,out 参数属性完全丢失了!非异步方法看起来不错。有了这个 GetServerInformationAsync 声明,我无法取回结果。这里发生了什么?

4

1 回答 1

2

out 参数(和任何结果)将在 EventArgs 类中,该类将传递给 GetServerInformation 完成时触发的事件(可能是 GetServerInformationCompleted)。属性名称可以是 Result(这很可能是只返回 1 个值的操作)或参数名称(属性)。

于 2011-09-28T23:59:40.267 回答