上传到服务器主机时不能调用webservice
本文关键字:不能 调用 webservice 主机 服务器 | 更新日期: 2023-09-27 18:17:09
请帮助我解决有关webservice的问题:
"服务器无法处理请求。生成XML文档出错。在序列化WebserviceLicenseKey.License_PaymentInfo类型的对象时检测到循环引用。"
当我使用localhost与webservice,这是好的。但是当我更新到服务器主机时,无法获得数据并引发上述错误。
这是我在webservice中的代码,我使用dbml
**[WebMethod]
[SoapDocumentMethod(Binding = "LicenseKeyService")]
[SoapHeader("UserAccount", Required = true)]
public List<License_PriceDayInfo> GetAllPriceDayInfo()
{
if (!CheckUserAccount())
return null;
return _context.License_PriceDayInfos.ToList();
}**
,在客户端调用webservice并获取数据为:
**_userCredentials.UserName = "abc";
_userCredentials.Password = "123456";
_licenseWs.UserCredentialsValue = _userCredentials;
var a = _licenseWs.GetAllPaymentInfo().ToList();**
请帮帮我!!
非常感谢!
在您的数据契约中,您可能有某种类型的属性,该属性返回到其父属性。默认情况下,序列化程序无法处理此问题,因为它将导致永无休止的序列化。
为了解决这个问题,你可以使用扁平的数据契约而不是分层的,这样你就不会有这种关系(推荐),或者在你的数据契约属性上使用IsReference属性。