简体   繁体   English

.NET应用程序有时会在应用程序启动时崩溃(无法访问.exe)

[英].NET applications sometimes crash right at application startup (can't access .exe)

We are currently encountering the following behaviour of our software on one of our customer computers: 当前,我们在一台客户计算机上遇到我们软件的以下行为:


Short version: 简洁版本:

Our .NET applications sometimes crash instantly when being executed from a client, with the executables being located on a separate file server. 从客户端执行我们的.NET应用程序有时会立即崩溃,而可执行文件位于单独的文件服务器上。

When this happens, a message in the Event Log claims that the executable couldn't be accessed. 发生这种情况时,事件日志中会显示一条消息,指出无法访问该可执行文件。 However the desktop shortcut always finds the executable. 但是,桌面快捷方式始终会找到可执行文件。

Note that this happens to several different .NET executables. 请注意,这发生在几个不同的.NET可执行文件中。

This leads us to the following 这导致我们以下


Question: 题:

How can windows always access the executable (the process is visible in task manager when it crashes) but the .NET Framwork can only sometimes access it? Windows如何始终访问可执行文件(该程序在崩溃时在任务管理器中可见),但是.NET Framwork有时只能访问它? Note that our customer sometimes has network problems for an unknown reason. 请注意,我们的客户有时由于未知原因会遇到网络问题。
And, more importantly, is there anything we can do to prevent the crash or at least show an own message box in such a case? 而且,更重要的是,在这种情况下,我们能做些什么来防止崩溃或至少显示一个自己的消息框?

For more information, read below: 有关更多信息,请阅读以下内容:


Detailed information: 详细资料:

Our C# executables are located on a virtualized file server (Windows Server 2003) and were compiled with .NET 3.5 SP1. 我们的C#可执行文件位于虚拟文件服务器(Windows Server 2003)上,并使用.NET 3.5 SP1进行了编译。

When trying to execute the software using a desktop/start menu shortcut from a client in the same network, the executable sometimes (around 2-5% of the number of tries) crashes, ie the user receives a "<our software> has encountered an error and needs to close" message. 当尝试使用同一网络中客户端的桌面/开始菜单快捷方式执行软件时,可执行文件有时会崩溃(尝试次数的2-5%),即用户收到“ <我们的软件>错误,需要关闭”消息。 For reference, the client has installed .NET 3.5 SP1 as well. 作为参考,客户端还安装了.NET 3.5 SP1。

Further investigation showed that the program crashes before even a single line of our code is executed (ie the main() method is never reached). 进一步的调查表明,即使在执行一行代码之前,该程序也会崩溃(即,永远无法到达main()方法)。

In the Windows Event Log, there are two messages, the first being relatively useless (free translation from German): 在Windows事件日志中,有两条消息,第一条消息相对没用(德语免费翻译):

Failed application, Version 0.0.0.0, failed module unknown, Version 0.0.0.0, Failure address 0x79002c42. 失败的应用程序,版本0.0.0.0,失败的模块未知,版本0.0.0.0,失败地址0x79002c42。

The second one says something like: 第二个说:

Due to one of the following reasons, the file \\\\<server>\\<path to software>\\<executable>.exe cannot be accessed: There is a problem with the network connection, the drive where the file is stored respectively the disk drivers which are installed on the computer, or the drive is missing. 由于以下原因之一,无法访问文件\\\\ <服务器> \\ <软件的路径> \\ <可执行文件> .exe:网络连接出现问题,文件所在的驱动器或磁盘均存在问题计算机上安装的驱动程序或驱动器丢失。 The program <executable>.exe was closed due to this error. 由于此错误,程序<executable> .exe被关闭。

[some suggestions on what to do] [关于做什么的一些建议]

More information: 更多信息:
Error Code: C0000008 错误代码:C0000008
Drive Type: 4 驱动器类型:4

Now the first suggestion is to try opening the file again, as the situation is probably a temporary problem. 现在,第一个建议是尝试再次打开文件,因为这种情况可能是暂时的问题。 While this "solution" works, it is not acceptable to have an application crash message, especially when one of our executables calls another one. 尽管此“解决方案”有效,但是出现应用程序崩溃消息是不可接受的,尤其是当我们的一个可执行文件调用另一个可执行文件时。

If you cannot answer the question(s) above directly, but you have an idea how to further investigate this, feel free to comment or answer. 如果您不能直接回答上面的问题,但是您有一个如何进一步调查的想法,请随时发表评论或回答。 Note however that we are not allowed to install any kind of third party software on our customer clients or even servers. 但是请注意,我们不允许在客户客户甚至服务器上安装任何类型的第三方软件。 Portable Apps (more precisely software which can be copy/pasted into a single folder and which does not deploy any kind of file to anywhere outside that single folder) can be used. 可以使用可移植的应用程序(更准确地说,可以将软件复制/粘贴到单个文件夹中,并且不会将任何类型的文件部署到该单个文件夹之外的任何位置)。

If it was me I would firstly see if I could re-create the issue locally and completely eliminate the network. 如果是我,我将首先查看是否可以在本地重新创建问题并完全消除网络。 Its all about building up clues that will hopefully lead you closer to the solution. 所有关于建立线索的希望都将使您更接近解决方案。 Other things that maybe worth thinking about are: 其他可能值得考虑的事情是:

  1. 32bit vs 64bit, What was the target for your compilation? 32位与64位,您的编译目标是什么?
  2. Is there any funky scripts running on the server? 服务器上是否运行任何时髦的脚本?
  3. Does it behave in the same manner on a different server? 它在另一台服务器上的行为是否相同?
  4. Maybe try removing the .NET framework from the server and then re-installing it 也许尝试从服务器中删除.NET框架,然后重新安装
  5. Make sure that there are not any other errors in the event log from other parts of the system 确保事件日志中没有来自系统其他部分的任何其他错误
  6. Is there any firewall or anti-virus on the server that maybe interfering with the application 服务器上是否有任何防火墙或防病毒软件可能会干扰应用程序
  7. I would also run a memory tester on the server and possibly also chkdsk but this is just a general thing to eliminate that wouldn't hurt to do as a matter of course 我还将在服务器上运行一个内存测试器,也可能在chkdsk上运行,但这只是消除的一般问题,当然这不会造成伤害
  8. I would even swap out the network lead (extremely unlikely its this) 我什至会换掉网络主管(这极不可能)
  9. Try putting the application on a different UNC share and see if you can re-create it from there 尝试将应用程序放在其他UNC共享上,看看是否可以从那里重新创建它

Process of elimination is the name of the game, even the most unlikely candidates shouldn't be overlooked. 淘汰的过程就是比赛的名字,即使是最不可能的候选人也不应被忽视。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM