System.IO.IOException:设备尚未就绪 [英] System.IO.IOException: The device is not ready

查看:1137
本文介绍了System.IO.IOException:设备尚未就绪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



i需要帮助,



每当我运行我的网站时我收到错误msg喜欢 System.IO.IOException:设备没有准备好



代码

====

Hi friends,

i need help,

whenever i run my site i receive the error msg like System.IO.IOException: The device is not ready

code
====

private Log()
       {
           if (AppConfigs.IsLogEnabled)
           {
               if (WebLog == null)
               {
                   engine = new CommonEngine();

                   string appPath = string.Empty;
                   if (!string.IsNullOrEmpty(AppConfigs.LogPath))
                       appPath = AppConfigs.LogPath;
                   else
                       appPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "logs");

                   DirectoryInfo di = new DirectoryInfo(appPath);
                   if (!di.Exists)
                       di.Create();

                   string fileName = AppConfigs.ApplicationName + "_" + engine.GetDateSuffix("") + ".log";

                   FileInfo fi = new FileInfo(Path.Combine(appPath, fileName));

                   if (fi.Exists)
                       tw = File.AppendText(fi.FullName);
                   else
                       tw = new StreamWriter(fi.FullName);

                   sb = new StringBuilder();
                   HasError = false;

               }

           }
       }





错误来了 di.Create(); 这一行,任何人都可以帮我解决这个问题需要做的事情。



谢谢

renga



error coming di.Create(); this line, can anybody pls help what i need to do for this issue.

thanks
renga

推荐答案

尝试将数据存储在应用程序文件夹或任何子目录中并不是一个好主意:在生产中这些通常是写保护的减少病毒活动。



看看这里:我应该在哪里存储我的数据? [ ^ ] - 它建议一些应该始终可用的更安全的地方。
It's not a good idea to try and store data in your application folder, or any subdirectory: in production these are normally write protected to reduce virus activity.

Have a look here: Where should I store my data?[^] - it suggests some "safer" places which should always be available.


这篇关于System.IO.IOException:设备尚未就绪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆