0

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

msjonathan
  • 514
  • 2
  • 11
  • 26
  • 1
    Hi have you looked at: http://msdn.microsoft.com/en-us/library/ms789008.aspx msmq binding for WCF. I don't think it'll be possible with the net or http bindings. – albertjan Jan 03 '12 at 15:54
  • 1
    No there is no way to return this type from WCF service. That type is only for native MSMQ communication. You must use valid serializable return type. – Ladislav Mrnka Jan 03 '12 at 16:29

1 Answers1

0

I created a own datacontract and let the client / server create MSMQ messages with the properties of that datacontract.

msjonathan
  • 514
  • 2
  • 11
  • 26