Unable to create reference for Message contract - Host in 4.0 and Client in 2.0

117 Views Asked by At

I have a service which is written in .net 4.0. I am calling it from .net 2.0. Everything works fine if I use Data Contract. But for one specific functionality, I need to Message contract. Intellisense do not show my message contract. Even in the reference that I added, I dont have message contract. I created a separate 4.0 framework and it works fine.

Is there any compatibility issue as we have separate web and service reference in 4.0 however in 2.0 we only have web reference?

Thanks in advance.

1

There are 1 best solutions below

0
On

I thought of answering this question as it might save other's time.

The functionality I was looking for was to send file or attachment. With WCF, you need message contract instead of Data Contract to send over an attachment or stream object.

As message contract was introduced in framerwork 3.5, with 2.0 it was not possible.

How did I solve my problem?

I sent my file in bit array form over to 4.0 application and from there, I used message contract to pass my information.

It took me 2 days to figure this out. I hope it helps others.