是否可以在服务合同中返回System.Messaging.Message



Hej,我在我的WCF服务中使用httpBinding/netTcpBinding,我正在尝试用WCF替换一些.Net远程处理代码。这是我将 .Net 远程处理的方法转换为 WCF 服务协定时的第一次测试。我从字面上翻译了我的方法,旧代码使用System.Messaging.Message作为返回类型。

我的服务合同:

<OperationContract(Name:="ReceiveWithTimeOut")>
  <TransactionFlow(TransactionFlowOption.Allowed)>
  Function Receive(ByVal TimeOut As TimeSpan) As System.Messaging.Message

每次构建,服务都会上升,但是当我浏览我的服务时,我收到以下错误:

System.InvalidOperationException:在调用 a WSDL 导出扩展: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://..../ServiceContracts/2012/V1:IReaderContract ----> System.Runtime.Serialization.InvalidDataContractException: Type "System.Messaging.MessageQueue"不能序列化。

有没有办法返回 System.Messaging.Message?

谢谢。

亲切问候。

乔纳森

我创建了一个自己的数据合约,并让客户端/服务器使用该数据合约的属性创建 MSMQ 消息。

相关内容

最新更新