C#服务无法在Windows7上启动 [英] C# service not Starting on Windows7
问题描述
我有一个用C#编写的Windows服务,该服务与COM dll交互.该应用程序通过代码运行良好.我能够调试应用程序.但是,当我将文件放在system32文件夹中并从那里启动服务时,它给出了错误-
System.AccessViolationException:尝试读取或写入受保护的内存.这通常表明其他内存已损坏.
我无法弄清楚,为什么该应用程序没有从system32目录运行,而没有从代码正常运行.
注意:我使用的是Windows 7 32位系统.该应用程序正在使用.net Framework 2.0
我已经注册了必需的dll. (该应用程序可以在Windows XP上正常运行.)
谁能给我一些启示,我该怎么办?我缺少什么吗?
Hi, I have a windows service written in C# which interacts with COM dll. The application is running fine from code. I am able to debug application. But when I put the files in system32 folder and start the service from there, it gives error -
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I am not able to figure out, why the application is not running from system32 directory and running fine from code.
Note: I am using Windows 7 32bit system. The application is using .net Framework 2.0
I have registered required dlls. (The application runs fine on windows xp.)
Can anyone throw some light, what I should do? Am I missing something?
推荐答案
您不能将文件放在system32文件夹中(在Vista/Win7中).那是安全违规.尝试将它们放入程序文件(x86)"中自己的文件夹中.
You can''t put files in the system32 folder (in Vista/Win7). That''s a security violation. Try putting them into their own folder inside "program files (x86)".
这篇关于C#服务无法在Windows7上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!