是否可以在 serviceContract 中返回 System.Messaging.Message?
嘿嘿, 我在 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:调用时引发异常 WSDL 导出扩展: System.ServiceModel.Description.DataContractSerializerOperationBehavior 合同: http://..../ServiceContracts/2012/V1:IReaderContract ----> System.Runtime.Serialization.InvalidDataContractException:类型 “System.Messaging.MessageQueue”无法序列化。
有什么方法可以返回 System.Messaging.Message 吗?
非常感谢。
亲切的问候。
乔纳森
Hej,
I am using the httpBinding / netTcpBinding in my WCF service, I am trying to replace some .Net remoting code with WCF. This was my first test when translating the methods of my .Net remoting to a WCF service contract. I translated my methods literally the old code uses System.Messaging.Message as return type.
My service contract:
<OperationContract(Name:="ReceiveWithTimeOut")>
<TransactionFlow(TransactionFlowOption.Allowed)>
Function Receive(ByVal TimeOut As TimeSpan) As System.Messaging.Message
Everyting builds, service goes up but when I surf to my service i got the following error:
System.InvalidOperationException: An exception was thrown in a call to
a WSDL export extension:
System.ServiceModel.Description.DataContractSerializerOperationBehavior
contract: http://..../ServiceContracts/2012/V1:IReaderContract ---->
System.Runtime.Serialization.InvalidDataContractException: Type
'System.Messaging.MessageQueue' cannot be serialized.
Is there any way to return a System.Messaging.Message?
Thank you very much.
Kind regards.
Jonathan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我创建了一个自己的数据契约,并让客户端/服务器使用该数据契约的属性创建 MSMQ 消息。
I created a own datacontract and let the client / server create MSMQ messages with the properties of that datacontract.