svcutil 忽略异步 WCF 调用的参数
我有一个服务 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);
}
如您所见,输出参数属性完全丢失!非异步方法看起来不错。 通过 GetServerInformationAsync 的声明,我无法返回结果。 这是怎么回事?
I have a service WCF interface:
[ServiceContract(Namespace = "net.pipe://QFX_DLL/TradingService")]
public interface IGenericTradingInterface {
[OperationContract]
void GetServerInformation(out ServerAttributes attributes);
}
The host for this is up and running correct. I create the client proxy object with svcutil as follows:
svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config net.pipe://localhost/QFX_DLL/mex /async /tcv:Version35
The generated proxy for the async call looks like this:
public void GetServerInformationAsync()
{
this.GetServerInformationAsync(null);
}
As you see, the out parameter attributes is completely missing! The non-async methods look fine.
With this declaration of GetServerInformationAsync I can't get the result back.
What's going on here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
out 参数(以及任何结果)将位于 EventArgs 类中,该类将传递给 GetServerInformation 完成(可能是 GetServerInformationCompleted)时触发的事件。属性名称可以是 Result(这可能是仅返回 1 个值的操作的情况)或参数名称(属性)。
The out parameter (and any results) will be in the EventArgs class which is passed to the event which is fired when GetServerInformation completes (likely GetServerInformationCompleted). The property name will be either Result (which is likely the case in an operation returning only 1 value) or the parameter name (attributes).