"The application has failed to start because its side-by-side configuration is incorrect."

背景:

      前段时间写了一个exe程序,一直以来运行在xp,server 2003上面,都运行良好。最近需要把它重新部署到一台新的server上面,是Windows server 2008 R2 Standard版,不想却一直不能正常运行。

 

症状:

      当双击运行程序时,弹出错误窗口,如下:

 

打开 Event Viewer,错误信息如下:

Activation context generation failed for "C:/xxx/xxxxx/xxx.exe". Dependent Assembly Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.

 

继续,用sxstrace.exe 来跟踪错误:

1. 开始运行

C:/Windows/system32>sxstrace.exe trace -logfile:c:/mytrace.etl
Tracing started. Trace will be saved to file c:/mytrace.etl.
Press Enter to stop tracing...

2. 双击应用程序,重现错误

3. 关闭上面运行的sxstrace.exe

4. 导出错误信息

C:/Windows/system32>sxstrace.exe parse -logfile:c:/mytrace.etl -outfile:c:/mytrace.txt
Parsing log file c:/mytrace.etl...
Parsing finished! Output saved to file c:/mytrace.txt.

 

错误信息如下:

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = Wow32
    CultureFallBacks = en-US;en
    ManifestPath = C:/xxx/xxxxx/xxx.exe
    AssemblyDirectory = C:/xxx/xxxxx/
    Application Config File =
-----------------
INFO: Parsing Manifest File C:/xxx/xxxxx/xxx.exe.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
    INFO: Reference: Microsoft.VC90.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Resolving reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
    INFO: Resolving reference for ProcessorArchitecture WOW64.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:/Windows/assembly/GAC_32/Microsoft.VC90.CRT/9.0.21022.8__1fc8b3b9a1e18e3b/Microsoft.VC90.CRT.DLL.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:/Windows/assembly/GAC_32/Microsoft.VC90.CRT/9.0.21022.8__1fc8b3b9a1e18e3b/Microsoft.VC90.CRT.DLL.
                INFO: Attempt to probe manifest at C:/carryquote/ServiceSHFE/Microsoft.VC90.CRT.DLL.
                INFO: Attempt to probe manifest at C:/carryquote/ServiceSHFE/Microsoft.VC90.CRT.MANIFEST.
                INFO: Attempt to probe manifest at C:/carryquote/ServiceSHFE/Microsoft.VC90.CRT/Microsoft.VC90.CRT.DLL.
                INFO: Attempt to probe manifest at C:/carryquote/ServiceSHFE/Microsoft.VC90.CRT/Microsoft.VC90.CRT.MANIFEST.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    ERROR: Cannot resolve reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.

 

解决:

首先,C:/Windows/winsxs/Manifests 文件夹下面只有 x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.30729.1_none_dcc7eae99ad0d9cf 的 manifest 和 cat文件,但是没有找到 x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91 的 cat 和 manifest 文件。

所以可能是由于服务器中并没有安装关于 vs2008 的相关组件,所以产生上述错误。

 

从microsoft 官网下载 vcredist 程序, 安装之后,一切OK。

http://www.microsoft.com/downloads/en/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en

 

### 解决 Docker 服务启动失败的方法 当遇到 `docker.service` 启动失败的情况时,可以按照以下方法排查并解决问题。 #### 日志分析 检查日志文件可以帮助定位问题的根本原因。可以通过以下命令查看 Docker 守护进程的日志: ```bash journalctl -u docker.service ``` 此命令会显示与 `docker.service` 相关的所有日志信息[^1]。仔细阅读这些日志可能会发现错误的具体描述以及触发条件。 #### 文件权限验证 有时,Docker 的启动失败可能是由于 `/var/lib/docker/` 或其他相关路径的文件权限不正确引起的。确保该目录及其子目录具有正确的所有权和访问权限: ```bash sudo chown -R root:root /var/lib/docker/ sudo chmod -R 700 /var/lib/docker/ ``` #### SELinux 和 AppArmor 配置冲突 如果系统启用了 SELinux 或 AppArmor,则可能存在配置冲突导致 Docker 无法正常工作。尝试临时禁用 SELinux 并重新启动 Docker 来测试是否有效: ```bash setenforce 0 systemctl restart docker ``` 如果这解决了问题,说明需要调整 SELinux 策略以兼容 Docker 运行环境[^2]。 #### 检查依赖项 某些情况下,Docker 可能因为其依赖的服务未成功加载而未能启动。例如,“Wants”字段定义了弱依赖关系;即使某个被依赖单元(如 sshd-keygen.service)出现问题也不会阻止主要服务运行,但如果确实存在问题仍需注意关联影响[^3]。因此建议确认所有必要组件都处于健康状态。 #### 更新版本或回滚安装包 过期或者损坏的软件包也可能引起异常行为。更新至最新稳定版通常能够修复已知漏洞及性能改进: ```bash apt-get update && apt-get upgrade docker-ce docker-ce-cli containerd.io yum check-update ; yum install --assumeyes docker-ce docker-ce-cli containerd.io ``` 对于特定场景下升级不可行的情形考虑降级到之前稳定的发行版本号。 --- ### 提供一段示例脚本用于自动化诊断流程 下面给出了一段简单的 Bash 脚本来帮助自动完成上述部分操作: ```bash #!/bin/bash echo "Checking status of Docker..." systemctl status docker || echo "Docker is not running." if ! journalctl -xe | grep -q 'docker'; then echo "No recent entries found in system log concerning Docker." else echo "Reviewing last few lines from journald regarding Docker:" journalctl -xe | tail -n 20 fi # Verify directory permissions. DIR_PERM=$(stat -c '%a %U:%G' /var/lib/docker/) if [[ "$DIR_PERM" != "700 root:root" ]];then echo "/var/lib/docker has incorrect permission settings ($DIR_PERM). Attempting fix.." sudo chown -R root:root /var/lib/docker/ sudo chmod -R 700 /var/lib/docker/ fi echo "Restarting Docker service after checks completed." systemctl daemon-reload && systemctl restart docker ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值