如何安装Windows服务 使得它再调试Windows服务时不会报错最好要有图解
解决方案 »
- 请问c#做电力的实时分析系统
- C# 如何调用这种DLL啊,uint8_t和DCB对应什么变量?
- 能否将C++中的'>>'在C#中实现?
- 求一个进度条!假的真的都可以,只要实现就行。
- C#关于二维数组的新手问题。
- C# 中this[int index]是什么格式啊,以前没有见过啊
- *******richTextBox读取数据库中的image字段的问题?简单,在线等********
- 求一这个正则表达式,请问我要找出所有不包含"abc"这个字符串的内容,这个正规应该怎么写
- 请教C#中处理长度大于255的字符串的问题
- 提问?
- 卸载 Appdomain 时出错。 (异常来自 HRESULT:0x80131015)???
- WPF中没有PerformClick?如何模拟点击BUTTON?
cmd下cd 路径进到他们俩所在目录,然后“installutil 服务名”
把InstallUtil.exe 和你写的服务放在一起。你写的服务生成完应该在程序目录bin-》debug下,也是个.exe文件
2)然后进cmd。比如你的路径在f盘,就先敲“f:回车”,然后敲“cd空格你的路径(右键可以黏贴)”
3)敲命令“installutil空格你的服务名字(就是你服务的exe文件名)”
Copyright (c) Microsoft Corporation. All rights reserved.Usage: InstallUtil [/u | /uninstall] [option [...]] assembly [[option [...]] assembly] [...]]InstallUtil executes the installers in each given assembly.
If the /u or /uninstall switch is specified, it uninstalls
the assemblies, otherwise it installs them. Unlike other
options, /u applies to all assemblies, regardless of where it
appears on the command line.Installation is done in a transactioned way: If one of the
assemblies fails to install, the installations of all other
assemblies are rolled back. Uninstall is not transactioned.Options take the form /switch=[value]. Any option that occurs
before the name of an assembly will apply to that assembly's
installation. Options are cumulative but overridable - options
specified for one assembly will apply to the next as well unless
the option is specified with a new value. The default for all
options is empty or false unless otherwise specified.Options recognized:Options for installing any assembly:
/AssemblyName
The assembly parameter will be interpreted as an assembly name (Name,
Locale, PublicKeyToken, Version). The default is to interpret the
assembly parameter as the filename of the assembly on disk./LogFile=[filename]
File to write progress to. If empty, do not write log. Default
is <assemblyname>.InstallLog/LogToConsole={true|false}
If false, suppresses output to the console./ShowCallStack
If an exception occurs at any point during installation, the call
stack will be printed to the log./InstallStateDir=[directoryname]
Directory in which the .InstallState file will be stored. Default
is the directory of the assembly.
Individual installers used within an assembly may recognize other
options. To learn about these options, run InstallUtil with the paths
of the assemblies on the command line along with the /? or /help option.
2.把这个文件复制到你的exe项目文件去。
3.点击开始的运行,输入cmd。
4.用cd 你要安装服务器的文件路径
5.输入installutil 你的服务名称,installutil和你的服务名称要加空格。
6.installutil 你的服务名称 -u可以删除服务。
未能加载文件或程序集,你的服务和InstallUtil.exe要在一起
版权所有 (C) 2006 Microsoft Corporation。保留所有权利。C:\Windows\system32>C:C:\Windows\system32>cd \Users\smtp\WindowsService1\WindowsService1\bin\DebugC:\Users\smtp\WindowsService1\WindowsService1\bin\Debug>InstallUtil WindowsServi
ce1
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.在初始化安装时发生异常:
System.IO.FileNotFoundException: 未能加载文件或程序集“file:///C:\Users\smtp\Win
dowsService1\WindowsService1\bin\Debug\WindowsService1”或它的某一个依赖项。系统
找不到指定的文件。。C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug>我在cmd中运行就是发生这样的错误
我也按你的意思,把WindowsService1与InstallUtil放在一起
请告诉我是为什么?
你试试把“.exe"加上
版权所有 (C) 2006 Microsoft Corporation。保留所有权利。C:\Windows\system32>C:C:\Windows\system32>cd \Users\smtp\WindowsService1\WindowsService1\bin\DebugC:\Users\smtp\WindowsService1\WindowsService1\bin\Debug>InstallUtil WindowsServi
ce1.exe
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.
正在运行事务处理安装。正在开始安装的“安装”阶段。
查看日志文件的内容以获得 C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug
\WindowsService1.exe 程序集的进度。
该文件位于 C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\WindowsServic
e1.InstallLog。
正在安装程序集“C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\WindowsS
ervice1.exe”。
受影响的参数是:
logtoconsole =
assemblypath = C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\Window
sService1.exe
logfile = C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\WindowsServ
ice1.InstallLog
正在安装服务 My Sample Service...
正在日志 Application 中创建 EventLog 源 My Sample Service...在“安装”阶段发生异常。
System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可
访问的日志: Security。正在开始安装的“回滚”阶段。
查看日志文件的内容以获得 C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug
\WindowsService1.exe 程序集的进度。
该文件位于 C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\WindowsServic
e1.InstallLog。
正在回滚程序集“C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\WindowsS
ervice1.exe”。
受影响的参数是:
logtoconsole =
assemblypath = C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\Window
sService1.exe
logfile = C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug\WindowsServ
ice1.InstallLog
正在将事件日志还原到源 My Sample Service 的前一状态。
在 System.Diagnostics.EventLogInstaller 安装程序的“回滚”阶段发生异常。
System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可
访问的日志: Security。
在安装的“回滚”阶段发生异常。将忽略该异常并继续回滚。但是,在完成回滚后计算机可
能无法完全还原到它的初始状态。“回滚”阶段已成功完成。已完成事务处理安装。
安装失败,已执行回滚。C:\Users\smtp\WindowsService1\WindowsService1\bin\Debug>现在报的是这种错误
1.是不是你要安装的服务已存在,你去服务那个界面看看有么,要有用“installutil /u 服务”卸载
2.你先检查一下你的用户是不是在ADMINISERATOR 组里面,如果不是 加到管理员组里。可能是你没有写日志权限,我猜
2:我一般用C++封装CreateService API来注册服务,然后用IS来打包并调用,这样不管理是用户名、密码还是描述信息都可以自已控制。