网站运行一段时间后报错, 只要刷新马上就好, 请教各位大侠这是怎么回事,谢谢!
Aimis 2008-12-01 04:13:27
未能找到文件“D:\Code\Aspx\Test\Aspx\UserCenter\Solution\Count.txt”。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.IO.FileNotFoundException: 未能找到文件“D:\Code\Aspx\Test\Aspx\UserCenter\Solution\Count.txt”。
源错误:
行 11: uint nCount = 0;
行 12: string strFilePath = Server.MapPath("Count.txt");
行 13: System.IO.StreamReader srInfo = System.IO.File.OpenText(strFilePath);
行 14: while (srInfo.Peek() != -1)
行 15: {
源文件: d:\Code\Aspx\Test\Global.asax 行: 13
堆栈跟踪:
[FileNotFoundException: 未能找到文件“D:\Code\Aspx\Test\Aspx\UserCenter\Solution\Count.txt”。]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +328
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1038
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) +115
System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) +88
System.IO.StreamReader..ctor(String path) +112
System.IO.File.OpenText(String path) +32
ASP.global_asax.Application_Start(Object sender, EventArgs e) in d:\Code\Aspx\Test\Global.asax:13
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433
Count.txt这个文件其实是在d:\Code\Aspx\Test\下面,并且只有Global.asax文件中使用,用来网站访问计数的,但登陆后台不用计数,请问有没有什么好的解决方案?