启动网络服务时出现问题 [英] problems starting a Network service

查看:124
本文介绍了启动网络服务时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个用c#编写的服务,我需要以网络

服务的形式运行。我正在使用安装项目来安装服务。

如果我在用户的个人文件夹中安装该服务,我会收到以下

错误:

无法在本地计算机上启动< servicenameservice。错误5:

访问被拒绝。


如果我在ProgramFiles文件夹中安装该服务,我会收到以下内容

错误:

"本地计算机上的< servicenameservice启动然后停止。

如果没有工作可以自动停止某些服务


该服务在本地系统下运行正常。账号。

解决方案

嗯,你试过让你的服务告诉你出了什么问题吗?

也许会抓住一些异常并将真实的错误记录到事件日志中?

这也有助于了解您的服务正在尝试做什么...

例如,如果它试图使用

NT身份登录受保护资源,然后注意它将使用* computer *

身份(通过网络服务) ,而不是任何用户的身份。如果

您需要受保护的访问权限,一个选项是以特定用户身份运行。


Marc


< blockquote>

Marc Gravell写道:


好​​吧,你试过让你的服务告诉你出了什么问题吗?

可能会捕获一些异常并将真实错误记录到事件日志中?

这也有助于了解您的服务正在尝试做什么...

for例如,如果尝试使用

NT身份登录受保护资源,请注意它将使用*计算机*

身份(通过网络)服务),而不是任何用户的身份。如果

你需要受保护的访问权限,一个选项是作为特定用户运行。

Marc



嗨Marc,

我给了异常处理程序。捕获的异常是

InvalidOperationException如果服务安装在用户的

个人文件夹中。如果该服务安装在Program Files文件夹中,

则捕获的异常是TimeOutException。

我试图从服务控制器管理器启动该服务。

的行为是一样的。

感谢您的回复


你还没有真的表明了你的服务可能会尝试什么?b $ b ...如果你(正如你的建议)成功捕获了你的托管代码

中的异常,那么就有了一些线索什么异常处理程序

*环绕*可能会告诉你什么不起作用...


Marc


Hi,
I have a service written in c# that I need to run as a "Network
Service". I am using a setup project to install the service.
If I install the service in User''s Personal Folder, I get the following
error:
"Could not start the <servicenameservice on Local Computer. Error 5:
Access is denied."

If I install the service in ProgramFiles folder, I get the following
error:
"The <servicenameservice on Local Computer started and then stopped.
Some services stop automatically if they have no work to do"

The service runs fine under the "Local System" account.

解决方案

Well, have you tried getting your service to tell you what is wrong?
perhaps catch some exceptions and log the real error to the event log?
It would also help to know what your service is attempting to do...
for instance, if it is trying to log onto a protected resource using
the NT identity, then note that it will be using the *computer*
identity (via "network service"), and not the identity of any user. If
you need protected access, one option is to run as a specific user.

Marc



Marc Gravell wrote:

Well, have you tried getting your service to tell you what is wrong?
perhaps catch some exceptions and log the real error to the event log?
It would also help to know what your service is attempting to do...
for instance, if it is trying to log onto a protected resource using
the NT identity, then note that it will be using the *computer*
identity (via "network service"), and not the identity of any user. If
you need protected access, one option is to run as a specific user.

Marc

Hi Marc,
I gave the exception handler. The exception caught is
InvalidOperationException if the service is installed in user''s
Personal folder. If the service is installed in Program Files folder,
then the exception caught is TimeOutException.
I tried to start the service from the Service Controller Manager. The
behavior is the same.
Thanks for the response


You haven''t really indicated what your service might be attempting to
do... if you are (as you suggest) successfully catching exceptions in
your managed code, then some clue as to what the exception handler
*surrounds* will probably tell you what isn''t working...

Marc


这篇关于启动网络服务时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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