Windows 服务与桌面应用程序之间的交互 [英] Interaction between Windows service and desktop application

查看:64
本文介绍了Windows 服务与桌面应用程序之间的交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个由 Windows 服务和 C# 桌面应用程序组成的项目.

I am developing a project which consists of a Windows service and a Desktop Application in C#.

服务的工作是监控一组文件夹的任何更改,并将信息记录到数据库监控一组文件,如果更改,则替换为原始版本(类似于 Windows 文件保护)

The job of the Service are to monitor a set of Folders for any changes, and log the information to DB Monitor a set of files and if changed replace with original versions (similar like Windows File Protection)

桌面应用程序用于

  • 显示服务功能的状态
  • 在调试模式下(显示服务执行的活动的跟踪)
  • 配置文件夹和文件

在这种情况下,主要部分是服务和桌面应用程序之间的交互.

In this context, the major part is interaction between Service and the Desktop Application.

我有两个选择1. 远程处理2.WCF

I have 2 choices 1. Remoting 2. WCF

请建议哪种更适合我的场景,以及如何在调试模式下进行跟踪

Kindly suggest which is better and effective for my scenario, and how to trace in Debug Mode

推荐答案

我不能推荐您的两个选择中的任何一个,但是我建议使用 命名管道,因为这是我在我的服务 - 应用程序系统中使用的通信方式.

I can't recommend any of your two choices, however I do recommend using Named Pipes, since this is the way of communication that I use in my Service - Application systems.

查看此 SO 答案 以获取快速示例.

Check this SO answer for a quick example.

这篇关于Windows 服务与桌面应用程序之间的交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆