【发布时间】:2010-12-02 13:59:23
【问题描述】:
我有一个带有 web 方法的 .Net web 服务,它以接口对象作为参数,每当我尝试访问该方法时,我都会收到异常消息:无法序列化成员 Product IProduct,因为它是一个接口。
有什么解决问题的建议吗??
[WebMethod]
Public double CalculateTotal(IProduct product, int Quantity)
{
return product.Price * Quantity;
}
【问题讨论】:
-
想发布一些代码吗?
-
我觉得这里没有具体说明的是,将接口作为 Web 方法签名的一部分公开是否合适?根据我的个人经验,这似乎不是。
标签: c# .net web-services oop interface