这是我的代码
static void Main()
{
/*
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new OpenTableImporter()
};
ServiceBase.Run(ServicesToRun);*/
XMLReader x = new XMLReader(new LogCustome());
Console.ReadLine();
}
我得到了:
Not enough storage is available to process this command.
上的 Console.ReadLine()
你可以帮忙吗?
如你所见,班级LogCustome
几乎是空的:
class LogCustome
{
public void logStartService() { }
public void logStopService() { }
}
即使代码如此简单:
static void Main()
{
/*
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new OpenTableImporter()
};
ServiceBase.Run(ServicesToRun);*/
//XMLReader x = new XMLReader(new LogCustome());
Console.ReadLine();
}
我仍然有例外
答案 0 :(得分:2)
可能在项目属性上(因为您将其创建为服务),输出类型是Windows应用程序,将其更改为控制台应用程序,它将按预期工作。
答案 1 :(得分:0)
您尝试阅读超过254个字符的数据量是多少?
参见:
How to read very long input from console in C#?
Console.ReadLine() max length?