题
我曾经遇到过一个相当奇怪的错误,我不明白。我创建了旨在只是一个测试,看看我的web服务,从我的网络以外工作一个C#控制台应用程序。所做的只是尝试和每个阶段连接到Web服务,输出到控制台,并将其写入一个文本文件,这样他们就可以送我的日志。
它完美地制作3台XP机器(一个我的网络内,2之外)。 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的作家=无效;
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);
}
}
}
}
我很卡为什么上面的代码可以/会做到这一点。它是那种只是我想知道,部分,这可能发生在一个真正的客户机,或仅仅是我的老板的机器感染或东西。
感谢您
解决方案
东西是非常错误的,如果你在NTVDM结束了,因为这是XP的16位DOS仿真层。如果您重新复制EXE跨越后再次出现这种情况,我会调查安装在你的老板的PC软件(.NET framework版本,等等)。
我也想尝试在WinDbg中运行这个,看看你在哪里结束,得到了调用堆栈,一旦出故障等,我敢打赌,你会发现堆栈(间谍软件等),在一个陌生的模块。