简体   繁体   中英

WCF service (.NET 4.0) can have a .NET 2.0 client?

The scenario is like this:
I have a .NET 4.0 client-Server application that works fine.
I need to create a UserControl that can access the Server, but it needs to be created in .NET 2.0 (because customer application is .NET 2.0)

Does it exist a way to access .NET 4.0 WCF service from a 2.0 client?

NOTE:
it is not a Web service, but a standalone .exe server
No autentication used
Data transfered are almost basic (class with arrays and basic types within)
it uses client callbacks so protocol il net.tcp
optionally I can change protocol if I can still be able to use callbacks

You need to expose the WCF as a Web Service:

The you work as if it was a good old .asmx service (add reference and so on).

It doesn't matter if your WCF service is hosted in a .exe, a web app, a windows service...

Supporting callbacks is not possible in .NET 2.0 with .asmx services, so that you have to simulate a callbak using something like TcpListener and TcpClient .

Unfortunately this has to de done from scratch, but you can use the logic in the WCF implementation.

If your WCF 4.0 service is using basic http binding, you can use it in .NET 2.0 or in any other language.

Just use WSDL.exe to generate the proxy and use it in .NET or in any other language.

是的,您可以通过在客户端项目中添加.cs文件(代理类)的引用来在.net 2.0客户端中使用WCF服务。

Question solved a while ago. Well, not really solved...

After looking at an article about performance on .NET WCF, I decided to use .NET remoting. It is faster, compatible native .NET 2.0 and it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM