以worker角色创建和编写文件

时间:2014-02-27 06:06:31

标签: azure-worker-roles

我正在编写下面的代码来创建和编写工作者角色的文本文件c驱动器。 它在我的本地计算机上工作正常但在云服务上失败

 public override void Run()
    {
       //  This is a sample worker implementation. Replace with your logic.
        Trace.TraceInformation("Trail entry point called", "Information");

        try
        {
            while (true)
            {
                TextWriter tsw = new StreamWriter(@"C:\Hello.txt", true);
                tsw.WriteLine("Hi DA Testesting");
                tsw.Close();                    
                Thread.Sleep(10000);
                Trace.TraceInformation("Working", "Information");
            }
        }
        catch (Exception ex)
        {
            TextWriter tsw = new StreamWriter(@"C:\Hello.txt", true);
            tsw.WriteLine(ex.Message);
            tsw.Close();
        }
    }

0 个答案:

没有答案