【发布时间】:2016-04-24 11:51:11
【问题描述】:
我的 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\Admin\AppData\Local\Temp\Test Client Projects\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\71e9b3ab-7556-4f8d-87c7-c8bae5868d3a\Client.cs(427,26) : 错误 CS0644: 'SahandCL.dlgFingerUI' 不能来自特殊类'System.MulticastDelegate' c:\Users\Admin\AppData\Local\Temp\Test Client Projects\12.0\71e9b3ab-7556-4f8d-87c7-c8bae5868d3a\Client.cs(439,26) : 错误 CS0644: 'SahandCL.dlgOnFinger' 不能来自特殊类'System.MulticastDelegate'
问题是:如何在我的服务参考中使用委托?
【问题讨论】:
-
WCF 无法序列化委托类型。合约中使用的任何类型都必须使用 Data Contract 序列化程序或 Xml 序列化程序进行序列化。
-
我有一个设备有一些实时事件,我想在服务层使用它,用户界面可以触发这些事件,我该怎么办?
-
@HamidSOS,你为什么不让你的客户在服务上调用一个操作来完成委托的工作?