【发布时间】:2009-12-29 13:08:24
【问题描述】:
我在我的应用程序中使用 WCF 服务。我需要在服务类中返回一个自定义对象。 方法如下:
IService.cs:
[OperationContract]
object GetObject();
Service.cs
public object GetObject()
{
object NewObject = "Test";
return NewObject;
}
每当我调用服务时,它都会引发异常并显示以下消息:
System.ServiceModel.CommunicationException: "An error occured while receiving the HTTP response to <service path>"
内部异常:
System.Net.WebException: "The underlying connection was closed. An unexpected error occured on receive"
我们不能从 WCF 服务返回对象类型或自定义对象吗?
【问题讨论】:
-
你在哪里托管你的 wcf 服务?
标签: wcf