Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Service will not start
    primarykey
    data
    text
    <p>Not sure what the problem is. I looked online to try to ascertain why my service will not start, i am getting a 1053 error on my win 8. I tried on a win 7 machine and got the same error but no code. If the below code code looks familiar it's a mod of : <a href="http://www.codeproject.com/Articles/18521/How-to-implement-a-simple-filewatcher-Windows-serv" rel="nofollow">http://www.codeproject.com/Articles/18521/How-to-implement-a-simple-filewatcher-Windows-serv</a>. I got this example from Microsoft : <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx</a> to work though(A console app). Here is the code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;appSettings&gt; &lt;add key="WatchPath" value="C:\\testbin\\" /&gt; &lt;/appSettings&gt; &lt;startup&gt; &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt; &lt;/startup&gt; </code></pre> <p></p> <pre><code> using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading.Tasks; using System.Configuration; using System.IO; namespace FileWatcher { public partial class FileWatcherService : ServiceBase { private StreamWriter w = File.AppendText("log.txt"); public FileWatcherService() { InitializeComponent(); } protected override void OnStart(string[] args) { FileWatcher.Path = ConfigurationManager.AppSettings["WatchPath"]; //StreamWriter w = File.AppendText("log.txt"); } protected override void OnStop() { } } using System; namespace FileWatcher { partial class FileWatcherService { /// &lt;summary&gt; /// Required designer variable. /// &lt;/summary&gt; /// // log1 = new logClassogClass(); private System.ComponentModel.IContainer components = null; /// &lt;summary&gt; /// Clean up any resources being used. /// &lt;/summary&gt; protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// &lt;summary&gt; /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// &lt;/summary&gt; private void InitializeComponent() { this.FileWatcher = new System.IO.FileSystemWatcher(); ((System.ComponentModel.ISupportInitialize)(this.FileWatcher)).BeginInit(); // // FileWatcher // this.FileWatcher.EnableRaisingEvents = true; this.FileWatcher.IncludeSubdirectories = true; this.FileWatcher.Changed += new System.IO.FileSystemEventHandler(FileWatcher_Changed); this.FileWatcher.Created += new System.IO.FileSystemEventHandler(FileWatcher_Created); this.FileWatcher.Deleted += new System.IO.FileSystemEventHandler(FileWatcher_Deleted); this.FileWatcher.Filter = "*.*"; //this.FileWatcher.Renamed += new System.IO.FileSystemEventHandler(FileWatcher_Renamed); //this.FileWatcher.Changed = FileWatcher_Changed; // // FileWatcherService // //FileWatcher.Changed = += new System.IO.FileSystemEventHandler(FileWatcher_Changed); this.ServiceName = "FileWatcherService"; ((System.ComponentModel.ISupportInitialize)(this.FileWatcher)).EndInit(); } #endregion private System.IO.FileSystemWatcher FileWatcher; /* DEFINE WATCHER EVENTS... */ /// &lt;summary&gt; /// Event occurs when the contents of a File or Directory are changed /// &lt;/summary&gt; protected void FileWatcher_Changed(object sender, System.IO.FileSystemEventArgs e) { //code here for newly changed file or directory } /// &lt;summary&gt; /// Event occurs when the a File or Directory is created /// &lt;/summary&gt; private void FileWatcher_Created(object sender, System.IO.FileSystemEventArgs e) { //code here for newly created file or directory w.Write("\r\nLog Entry : "); w.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString()); w.WriteLine(" :"); w.WriteLine(" :{0}", "File created"); w.WriteLine("-------------------------------"); } /// &lt;summary&gt; /// Event occurs when the a File or Directory is deleted /// &lt;/summary&gt; private void FileWatcher_Deleted(object sender, System.IO.FileSystemEventArgs e) { //code here for newly deleted file or directory w.Write("\r\nLog Entry : "); w.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString()); w.WriteLine(" :"); w.WriteLine(" :{0}", "File deleted"); w.WriteLine("-------------------------------"); } /// &lt;summary&gt; /// Event occurs when the a File or Directory is renamed /// &lt;/summary&gt; private void FileWatcher_Renamed(object sender, System.IO.RenamedEventArgs e) { //code here for newly renamed file or directory w.Write("\r\nLog Entry : "); w.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString()); w.WriteLine(" :"); w.WriteLine(" :{0}", "File edited"); w.WriteLine("-------------------------------"); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload