我收到异常'基础连接已关闭:访问WCF方法时,连接意外关闭,返回业务实体。在向业务实体类添加新属性后发生这种情况。当我评论新属性时,它工作正常并返回数据。我搜索了论坛,发现如果WCF方法返回的是void以外的东西,那么问题很可能与无法序列化返回值有关,而不是与底层连接有关。
Also, I have ensured that I added `[DataMember]` attribute
above the newly added property.
// new property added
[DataMember]
public bool isEmployer
{ get { return m_isEmployer; }
set { m_isEmployer = value;}
}
// The exception comes from a class named EmpServiceProxy
internal class EmpServiceProxy : ClientBase<IEmpService>, IEmpService
// the method is
public MyBusinessEntity GetDetails()
{
return Channel.GetDetails(); // exception pops up here
// it is not going to the factory class to call stored procedure.
}
// See the IEmpService class.
[ServiceContract]
[ServiceKnownType(typeof(ObjectListSurrogated<UserClt>))]
[ExceptionShielding]
[UseObjectListSurrogate]
public interface IEmpService
{
[OperationContract]
[FaultContract(typeof(MyAppFault))]
MyBusinessEntity GetDetails();
}
Also, added `< dataContractSerializer maxItemsInObjectGraph="2147483646"/>`
到配置文件。
此外,确保属性[KnownType(typeof(MyBusinessEntity))]
在继承类的业务实体之上添加。但没有任何帮助。
Any help anybody could provide would highly be appreciated.
谢谢, 拉西什