我正在調用使用InvokeMember方法的WCF方法.WCF方法將一個整數和一個out對象作爲參數。這是在WCF服務的代碼:Reflection和WCF
public int SimpleTest(int n, out object OBJ)
{
OBJ = new Int32();
OBJ = 12;
return n;
}
當我使用InvokeMember調用函數用參數new Object[]{1 , obj}
,物鏡12變爲如預期。
但是當內部SimpleTest的OBJ設置爲一個複雜的對象(OBJ = new MyClass())
我得到的頁面上出現以下異常調用的方法:Exception has been thrown by the target of an invocation.
的內部異常指出The underlying connection was closed: The connection was closed unexpectedly.
我不明白爲什麼這個出現異常。有人可以解釋嗎?
這也可以是* regular *構造函數,而不僅僅是靜態ctor;包裝的異常只是由於InvokeMember – 2011-03-01 08:27:06
正如我的回答中提到的第一行:)。但我很確定其中一名建築師是這裏的罪魁禍首。 – 2011-03-01 08:28:04
MyClass是一個EntityObject ... – scatman 2011-03-01 09:16:26