配置系统无法初始化 - Windows Service .NET
我创建了一个 .NET Windows 服务,在开发计算机上安装时没有任何问题。在只有.NET框架(并且没有安装VS)的服务器上,由于我没有VS 2008提示符,所以我执行了以下操作。
- 我打开了命令提示符
cd C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727
- 我尝试使用
installutil.exe
安装该服务“路径service .exe”
我收到以下异常:
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.Configuration.ConfigurationErrorsException:
Configuration system failed to initialize
此服务在我的本地主机上安装/卸载没有任何问题。有什么帮助吗?
service.exe.config 如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- Should process conversions -->
<add key="Service.EnableConversions" value="true"/>
<!-- Poll Interval-->
<add key="Service.Interval" value="10000" /> <!-- Set to 10 seconds -->
</appSettings>
</configuration>
I created a .NET windows service that installs without any issues on the dev machine. On the server that has only the .NET framework (and no VS installed), since I don't have the VS 2008 prompt, I did the following.
- I opened the command prompt
- I did
cd C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727
- I attempted to install the service using
installutil.exe
"Path to the service .exe"
I get the following exception:
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.Configuration.ConfigurationErrorsException:
Configuration system failed to initialize
This service installs/uninstalls without any issues on my local host. Any help?
The service.exe.config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- Should process conversions -->
<add key="Service.EnableConversions" value="true"/>
<!-- Poll Interval-->
<add key="Service.Interval" value="10000" /> <!-- Set to 10 seconds -->
</appSettings>
</configuration>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是服务器上的 machine.config 损坏的问题。重新安装后这个问题就解决了。
It was an issue with a corrupt machine.config on the server. After reinstalling it this issue was resolved.
从 C:\Windows\Microsoft.NET\Framework\v4.0.30319 文件夹运行 InstallUtil.exe 时收到此错误。要修复此问题,请尝试将 machine.config.default 复制到 machine.config(如果当前的 machine.config 实际上存在于 Config 目录中,则可以备份它)。
现在切换到父目录并运行InstallUtil.exe /?查看它是否显示使用信息。
希望这有帮助。
保罗
Received this error running InstallUtil.exe from the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder. To fix, try copying the machine.config.default to machine.config (maybe backup your current machine.config if it is actually present in the Config directory).
Now change to the parent directory and run InstallUtil.exe /? to see if it displays the usage info.
Hope this helps.
Paul
不确定为什么您的配置会引起任何麻烦...
您可以尝试使用
sc.exe
工具创建并安装您的服务吗?它是 Windows 的一部分,应该出现在所有更新的 Windows 版本中。执行
sc -?
以获取有关所有参数的完整信息。基本上,要创建和安装该服务,您需要:
注意“=”符号后的空格!它们是必需的 - 没有它们,它就无法工作(我知道这很奇怪 - 但这就是语法 - 相信我)。
Not sure why your config should cause any trouble....
Can you try to create and install your service with the
sc.exe
tool instead? It's part of Windows and should be present on all more recent Windows versions.Do a
sc -?
to get the full info about all the parameters.Basically to create and install the service, you need:
Watch for the spaces after the "=" sign! They're needed - without them, it won't work (I know it's odd - but that's the syntax - trust me).