2016-04-24 32 views
1

我在我的wcf服務中遇到問題。在wcf服務參考中使用代表

這裏是我的服務接口類:

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together. 
[ServiceContract] 
public interface ISahandService 
{ 
    [OperationContract] 
    bool uRunCommand(byte[] abyJson, ref byte[] abyData); 

    [OperationContract] 
    bool uFillSaatDic(ref List<DeviceInfo> liDev, ref string sErr); 

    [OperationContract] 
    void uSetDelegates(dlgDeviceConnectFunc uDeviceConnect, dlgServerBusyFunc uServerBusyFunc, 
     dlgAminConnection uAminFunc, dlgFingerUI uFingerUI, dlgOnFinger uOnFinger); 

    [OperationContract] 
    CompositeType GetDataUsingDataContract(CompositeType composite); 

    // TODO: Add your service operations here 
} 

和錯誤是:

無法添加服務。服務元數據可能無法訪問。確保您的服務正在運行並展示元數據。

C:\ Users \用戶管理\應用程序數據\本地\ TEMP \測試客戶項目\ 12.0 \ 71e9b3ab-7556-4f8d-87c7-c8bae5868d3a \ Client.cs(391,26):錯誤CS0644:「SahandCL。 dlgDeviceConnectFunc'不能派生自特殊類'System.MulticastDelegate' c:\ Users \ Admin \ AppData \ Local \ Temp \ Test Client Projects \ 12.0 \ 71e9b3ab-7556-4f8d-87c7-c8bae5868d3a \ Client.cs(403,26) :錯誤CS0644:'SahandCL.dlgServerBusyFunc'不能派生自特殊類'System.MulticastDelegate' c:\ Users \ Admin \ AppData \ Local \ Temp \ Test Client Projects \ 12.0 \ 71e9b3ab-7556-4f8d-87c7-c8bae5868d3a \ Client .cs(415,26):錯誤CS0644:'SahandCL.dlgAminConnection'不能從特殊類'System.MulticastDelegate'派生' c:\ Users \ Admin \ AppData \ Local \ Temp \ Test Client Projects \ 12.0 \ 71 e9b3ab-7556-4f8d-87c7-c8bae5868d3a \ Client.cs(427,26):錯誤CS0644:'SahandCL.dlgFingerUI'不能從特殊類'System.MulticastDelegate' c:\ Users \ Admin \ AppData \ Local \ Temp \測試客戶端項目\ 12.0 \ 71e9b3ab-7556-4f8d-87c7-c8bae5868d3a \ Client.cs(439,26):錯誤CS0644: 'SahandCL.dlgOnFinger' 不能從特殊類派生 'System.MulticastDelegate'

問題是:我如何在我的服務參考中使用代表?

+1

WCF無法序列化委託類型。合約中使用的任何類型都必須使用Data Contract序列化程序或Xml Serializer進行序列化。 – ajawad987

+0

我有一個設備有一些實時事件,我想在服務層使用它,並且可以觸發該事件,我該怎麼辦? – HamidEbr

+0

@HamidSOS,你爲什麼不直接讓你的客戶端調用一個代理服務的操作呢? – Crowcoder

回答

1

定義WCF合同時只允許使用已知類型。