“/”应用程序中的服务器错误。

未能找到路径“E:\work\ChemsbWeb\ChemsbWeb\WebChemsb\BaiduAd\Ad3.txt”的一部分。

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.IO.DirectoryNotFoundException: 未能找到路径“E:\work\ChemsbWeb\ChemsbWeb\WebChemsb\BaiduAd\Ad3.txt”的一部分。

源错误:


行 27:     {
行 28:         string GetPath = WebServer.Doconfig.GetValue("WebPath") + "WebChemsb\\BaiduAd\\" + AdName;
行 29:         StreamReader reader = new StreamReader(GetPath, Encoding.GetEncoding("gb2312"));
行 30:         string str = reader.ReadToEnd();
行 31:         reader.Close();

源文件: e:\work\chemsbweb\ChemsbWeb\Chemsb\WebChemsb\App_Code\WebSiteAd.cs    行: 29

堆栈跟踪:


[DirectoryNotFoundException: 未能找到路径“E:\work\ChemsbWeb\ChemsbWeb\WebChemsb\BaiduAd\Ad3.txt”的一部分。]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +239
   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) +2580
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +138
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) +98
   System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) +139
   System.IO.StreamReader..ctor(String path, Encoding encoding) +20
   WebSiteAd.GetAdPath(String AdName) in e:\work\chemsbweb\ChemsbWeb\Chemsb\WebChemsb\App_Code\WebSiteAd.cs:29
   Trade_Des.Page_Load(Object sender, EventArgs e) in e:\work\chemsbweb\ChemsbWeb\Chemsb\WebChemsb\Trade\Des.aspx.cs:30
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428


版本信息: Microsoft .NET Framework 版本:2.0.50727.7905; ASP.NET 版本:2.0.50727.7905