从IronPython调用WCF不会返回复杂类型

时间:2011-09-06 14:09:19

标签: wcf ironpython

我正在调用WCF服务功能

[OperationContract]
ProcessInfo GetProcessInfo(); # ProcessInfo has a DataContract Attribute.

用IronPython脚本(v2.7)用C#编写。

调试器证明调用了服务并返回了正确的对象。

但是在IPy脚本中

import clr
clr.AddReference('System.ServiceModel')
import System.ServiceModel
clr.AddReference('Company.Service.Util')
from Company.Service.Util.Diagnostics import IServiceInspector 
bind = System.ServiceModel.BasicHttpBinding()
endpoint = System.ServiceModel.EndpointAddress("http://localhost:40099/ServiceInspector")
channel = System.ServiceModel.ChannelFactory[IServiceInspector](bind, endpoint)
client = channel.CreateChannel()
pi = client.GetProcessInfo()
print "GetProcessInfo() returned:\n%s" % pi

没有收到。

basicHttpBinding和tcpBinding都有相同的行为。

1 个答案:

答案 0 :(得分:1)

尝试使用调试信息运行脚本:ipy.exe -X:Debug -X:ExceptionDetail

尝试更简单的服务(例如返回字符串) - 我想您可能需要添加对存储System.Web的{​​{1}}程序集的引用。

相关问题