在我的WCF服務中有一個數據合同(比如EmployeeView
)。我已用Serializable
屬性裝飾它,並且所有成員都標記爲DataMember
WCF中的方法返回List<EmployeeView>
。 當我通過WCF Test客戶端或MVC應用程序執行此方法時,它會成功執行,但在傳輸結果時會給出錯誤The underlying connection was closed: The connection was closed unexpectedly
。雖然EmployeeView
被標記爲序列化,但是沒有序列化List<EmployeeView>
?是否列表<T>默認爲可序列化的?
進一步增加,如果我執行OperationContract的僅返回「EmployeeView」它給了我不同的錯誤說法,The service is offline or inaccessible; the client-side configuration does not match the proxy
這使事情奇怪,因爲其他的操作返回字符串等工作正常