您的位置:首页 > 运维架构 > 网站架构

网站发布后在IIS上定时执行任务

2016-01-18 16:34 525 查看
string filename = (DateTime.Now.ToString() + DateTime.Now.Millisecond.ToString()).Replace("/", "").Replace(":", "").Replace(" ", "") + ".txt";
// string file = "~/img/" + filename;
string file = @"C:\Users\Administrator\Documents\Visual Studio 2013\WebSites\testasax\img" + filename;
string content = "写入内容!";
if (System.IO.File.Exists(file) == true)
{
// MessageBox.Show("存在此文件!");
}
else
{
System.IO.FileStream myFs = new System.IO.FileStream(file, System.IO.FileMode.Create);
System.IO.StreamWriter mySw = new System.IO.StreamWriter(myFs);
mySw.Write(content);
mySw.Close();
myFs.Close();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: