protected void Application_Start ( object sender, EventArgs e ) { using (XmlReader configReader = XmlReader.Create(HttpContext.Current.Server.MapPath("~/App_Data/aws.config"))) { while (configReader.Read()) { if (configReader.IsStartElement()) { switch (configReader.Name) { case "s3-access-key": { Environment.SetEnvironmentVariable("S3_ACCESS_KEY", configReader.ReadString()); break; } case "s3-secret-key": { Environment.SetEnvironmentVariable("S3_SECRET_KEY", configReader.ReadString()); break; } default: break; } } } } m_statusQueue = new Dictionary<string, string>(); Application["as_statusQueue"] = m_statusQueue; m_fs = new FileStream(HttpContext.Current.Server.MapPath("~/App_Data/Queue.log"), FileMode.Append, FileAccess.Write, FileShare.ReadWrite); m_writer = new StreamWriter(m_fs, System.Text.Encoding.Default); m_watcher = new FileQueueWatcher(HttpContext.Current.Server.MapPath("~/App_Data/process-queue"), "", m_writer); m_watcher.Watch(false); }
public FileQueueWatcherService ( string queueFolder ) { // This call is required by the Windows.Forms Component Designer. InitializeComponent(); string logPath = Path.Combine( Path.GetDirectoryName(Environment.CurrentDirectory), "../App_Data/Queue.log"); FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); StreamWriter writer = new StreamWriter(fs, System.Text.Encoding.Default); m_folderName = queueFolder; m_fileWatcher = new FileQueueWatcher(queueFolder, "", Console.Out); }