Pro*_*ofK 6 memory console service readline
我正在使用双服务/控制台模型来测试我的服务.聚光灯下的代码是:
static void Main(string[] args)
{
// Seems important to use the same service instance, regardless of debug or runtime.
var service = new HostService();
service.EventLog.EntryWritten += EventLogEntryWritten;
if (Environment.UserInteractive)
{
service.OnStart(args);
Console.WriteLine("Host Service is running. Press any key to terminate.");
Console.ReadLine();
service.OnStop();
}
else
{
var servicesToRun = new ServiceBase[] { service };
Run(servicesToRun);
}
}
Run Code Online (Sandbox Code Playgroud)
当我在调试器下运行应用程序时,使用F5,在Console.ReadLine();我得到的行上System.IO.IOException,"没有足够的存储空间来处理此命令".
唯一的目的ReadLine是等到有人按下键来结束应用程序,所以我无法想象数据来自何处需要如此多的存储空间.