命名管道可以与服务一起使用吗? [英] Can named pipes work with a service?

查看:71
本文介绍了命名管道可以与服务一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:一台SQLServer 2005服务器; Windows 7工作站.
工艺:
一个工作站正在运行一个打开命名管道的应用程序.收到连接请求后,它将向SQL Server发送一个SQL UPDATE命令.在命名管道上的通信是单向的-建立连接后,将触发SQL UPDATE操作;指定的管道连接已关闭,程序正在等待另一个连接.

我的问题:
每天早晨,通过BAT文件启动打开命名管道"的应用程序,该文件执行指定/sqluser用户的RUNAS命令.效果很好.

但是,BAT文件本身将在一个用户帐户下启动,因此,如果该帐户要注销,则该任务将消失.因此,我想将应用程序转换为服务,可以在工作站启动时在任何特定用户会话之外启动该应用程序.只要工作站启动,它就始终可用.

将其修改为一项服务进行得很顺利,应用程序干净安装,干净启动/停止.但是,它到达了侦听命名管道请求的地步,但却从未听到过.我尝试了其他几个用户帐户,但没有任何效果.

有谁知道当几乎完全相同的独立应用程序使用相同的凭据正常监听时,是什么原因导致运行命名管道的服务无法监听?

Environment: a SQLServer 2005 server; Windows 7 workstations.
Process:
One workstation is running an application that opens a named pipe; upon receiving a connection request, it sends a SQL UPDATE command to the SQL server. Communication on the named pipe is one-way -- once the connection is made, that triggers the SQL UPDATE action; the named pipe connection is closed and the program awaits another connection.

My Problem:
The application opening the "named pipe" is started each morning via a BAT file which executes a RUNAS command specifying a user of <domain>/sqluser. This works perfectly.

However, the BAT file itself is kicked off under a user account, so if that account were to log off, the task would go away. So, I thought I would convert the app to a Service where it could be initiated at workstation startup, outside any specific user session. It would always be available so long as the workstation is up.

Modifying it to be a service went well, and the app installs cleanly, starts/stops cleanly. However, it reaches the point of listening for a named pipe request, but never hears it. I''ve tried several other user accounts, but nothing works.

Does anyone know what would cause a Service running named pipes to not listen, when the nearly-identical standalone app listens fine, using the same credentials?

推荐答案

Windows服务.我最近完成了这项工作,目的是建立与旧版应用程序的桥梁.由于需要提升特权,Windows 7出现了一些问题.最好忘记那些批处理文件.使用System.IO.Pipes.

—SA
They perfectly work for a Windows Service. I recently completed such job for the purpose of making a bridge to a legacy application. Some problem is Windows 7 due to a need to elevated privileges. Better forget those batch files. Work with System.IO.Pipes.

—SA


这是设计使然.由非管理员用户在Windows 7上创建的命名管道终结点只能与以同一用户身份运行的进程进行通信.可能的解决方法是以sqluser身份运行Windows服务.
This is by design. Named pipe endpoints created by non-Admin users on Windows 7 can only communicate with processes running as the same user. Perhaps a potential fix would be to run the Windows service as sqluser.


这篇关于命名管道可以与服务一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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