0

我遇到了一个我不明白的相当奇怪的错误。我创建了一个 C# 控制台应用程序,旨在测试我的 Web 服务是否在我的网络外部工作。它所做的只是尝试连接到 Web 服务,将每个阶段输出到控制台并将其写入文本文件,以便他们可以将日志发送给我。

它在 3 台 XP 机器上运行良好(一台在我的网络内,两台在我的网络外)。一台 Vista 机器(有一个清单文件)但在我老板的 XP 机器上(他是一名 IT 人员,所以知道他在做什么),它抛出了一个非常奇怪的错误。

C:\temp\testwe~1.exe NTVDM CPU遇到非法指令

http://www.houseofhawkins.com/roger.jpg">

我做了一些谷歌搜索,看起来他的 NTVDM 可能被窃听了,或者有病毒什么的。这些似乎都不是。我看不出会发生什么导致它以这种方式失败。

使用系统;使用 System.Collections.Generic;使用 System.Text;使用 System.IO;

命名空间 testwebservice { 类程序 { FileStream theFile = null; StreamWriter 作家 = null;

    static void Main(string[] args)
    {
        Program p = new Program();
        p.testMe();
    }

    private void testMe()
    {
        Console.WriteLine("Entered main method about to create stream");            
        try
        {
            theFile = File.Create(@"jonTestWebService.log");
            writer = new StreamWriter(theFile);
            writer.AutoFlush = true;

            try
            {
                message("Starting test at: " + DateTime.Now.ToLongTimeString());

                Random rand = new Random();

                message("creating new instance of webservice");
                houseofhawkins.testweb webServ = new testwebservice.houseofhawkins.testweb();

                message("calling hello world");
                String helloResult = webServ.HelloWorld();
                message("hello world result = " + helloResult);

                int one = rand.Next(999);
                int two = rand.Next(999);
                message("calling maths method with " + one + " + " + two);
                String mathResult = webServ.mytestMethod(one, two);
                message("Math result is: " + mathResult);



                message("Creating instance of CSJawbreaker");
                CSJawbreaker.InformationService csj = new testwebservice.CSJawbreaker.InformationService();

                message("trying to get the latest version number");
                float version = csj.latestVersionNumber();
                message("Version number: " + version.ToString());

                message("");
                message("Finished all processing at: " + DateTime.Now.ToLongTimeString());
            }
            catch (Exception ex)
            {
                writer.WriteLine("");
                writer.WriteLine(ex.Message);
                writer.WriteLine("");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("could not create stream Writer, " + ex.Message);
        }

        message("");
        message("Press return to exit");
        Console.ReadLine();

        writer.Close();
        theFile.Close();
    }

    private void message(String message)
    {
        if (theFile != null && writer != null)
        {
            Console.WriteLine(message);
            writer.WriteLine(message);
        }
    }
}

}

我很困惑为什么上面的代码可以/会这样做。这只是我想知道的部分,这可能会发生在真正的客户机器上,还是只是我老板的机器被感染了或其他什么。

谢谢

4

1 回答 1

1

如果您最终使用 NTVDM,那就大错特错了,因为这是 XP 的 16 位 DOS 仿真层。如果在您重新复制 EXE 后再次发生这种情况,我会调查安装在您老板 PC 上的软件(.NET 框架版本等)。

我还会尝试在 WinDbg 中运行它以查看最终结果,一旦出现故障等获取调用堆栈,我敢打赌你会在堆栈上找到一个奇怪的模块(间谍软件等)。

于 2008-12-08T05:57:37.050 回答