1

我是 WCF 的新手(只需一两天)。我打算制作一个具有客户端/服务器的应用程序

WCF 服务(在作为 Windows 服务托管的服务器上):

  1. 将使用 (Process.Start()) 调用一些命令
  2. 将从我的数据库中发送一些信息

问题:

  1. 我应该使用什么 WCF 绑定?WsDualhttp 或 netTCP (如果可以请详细说明)
  2. WCF 是否适用于SqlServer + EF 4.1

服务器界面:

这将主要用于

  1. 启动或停止上述服务
  2. 更改地址(本地主机到 [我的 IP 地址])和端口
  3. 显示服务状态(运行或死亡)

问题:

  1. 如何从此 UI 更改我的 WCF 服务的地址和端口(这将是一个不同的项目,因此是不同的配置文件)。

客户端应用程序:

  1. 用于向 WCF 服务发出命令。
  2. 了解服务是否正在运行或停止。
  3. 接收任务完成或故障的状态消息。

另外,windows安装程序可以结合安装ServerUI+WCF服务+Windows服务吗?

4

2 回答 2

1

WCF Service

  1. Here are a couple links on choosing the right binding. Based on the scenario you're describing, I'd go with the netTCP.
  2. WCF and SQL Server are independent of each other, so I wouldn't expect any problems using the Windows service to interact with your database.
  3. I'd suggest reading up on how to start a process from a Windows service.

Server UI

  1. I would suggest hosting another WCF service in your Windows service for interacting with your Server UI. You can use the netNamedPipeBinding since this communication channel will always be local, i.e., on the same box. So your Windows service will host two WCF services - one for the external communication with the client and one for the local communication with the configuration UI.

Installer

  1. Yes, the Windows installer can be used, but that might be overkill for what you're describing. Of the Server UI, WCF Service, and Windows service, the only one that absolutely requires installation is the Windows service. The others could theoretically run simply by copying the assemblies to the target system. You might consider having the Windows service install itself via command line. That way you could get away with a self-extracting executable using software like WinZip. This might be less heavyweight than a formal install. If you go this route, have a look at the step-by-step here.
于 2012-07-05T14:53:02.647 回答
0

看看 WCF 双工服务:http: //msdn.microsoft.com/en-us/library/ms731064.aspx

为什么你想要一个 Windows 服务的接口?如果您可以访问 IIS7 和 WAS,我建议您使用它而不是 Windows 服务中的自托管。

这是 WCF 配置管理的一个很好的起点:http: //msdn.microsoft.com/en-us/library/ff650534.aspx

是的,您可以使用 Windows 安装程序。

干杯——乔克

于 2012-07-05T08:00:32.407 回答