讨论 - 客户端服务器应用程序架构

问题描述:

我想使用 .Net 4、C# 和 SQL Server 开发一个基于客户端-服务器的桌面应用程序.

I want to develop a client-server based desktop application using .Net 4, C# and SQL Server.

请参考图片了解我的想法.

Please refer to the image for what i am thinking about.

会有一个服务器应用程序访问windows服务或web服务.客户端应用程序将具有多文档界面.

There will be a server application accessing windows service or web service. The client application will have Multiple Document Interface.

以下是我的想法 -

  1. 客户端应用程序将使用与服务器应用程序的套接字连接,以便从服务器获得身份验证,并跟踪服务器上的客户端连接记录.
  2. 该服务将成为网络服务
  3. 身份验证成功后,客户端应用程序将直接访问 Web 服务,因此服务器不会过载.

我希望您对此提供反馈,这是一种很好的实施方式还是有更好的方式?我应该使用 Windows 服务而不是 Web 服务吗?我应该对所有数据通信使用套接字连接而不是直接使用网络服务吗?

I want your feedback on this whether it is a good way to implement or is there a better way? Should i use windows service instead of web service? Should i use socket connectivity for all data communication instead of directly consuming the web service?

感谢您分享您的时间和智慧.

Thank you for sharing your time and wisdom.

问候

伊凡

对于所有客户端/服务器通信,绝对使用 Web 服务边界.

Most definitely use a web service boundary for all your client/server communications.

WCF 会做你想做的一切.您可以使用不同的绑定,甚至自定义他们使用的安全类型.

WCF will do everything you want. You can expose multiple endpoints with different bindings, and even customize what kind of security they use.

花一些时间深入研究 WCF 文档,我认为您会发现它非常适合您的架构图,而且您需要的一切都是开箱即用的.

Spend some time digging into the WCF documentation and I think you will find it is perfectly suited to your architecture diagram, and everything you need will be out-of-the-box.