背景:
前段时间写了一个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
本文介绍了一款使用Visual Studio 2008开发的exe程序在Windows Server 2008 R2上遇到的运行问题及解决办法。通过使用sxstrace.exe进行跟踪发现,缺少必要的Microsoft.VC90.CRT组件导致程序无法启动,最终通过安装vcredist得以解决。
2197

被折叠的 条评论
为什么被折叠?



