Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Service won't install "File Not Found Exception"
    primarykey
    data
    text
    <p>when I try installing my Service I get the following error:</p> <pre><code>Exception Occured while initializing the installation: System.IO.FileNotFoundException: Could Not load file or assembly 'file:///C:\...\bin\Debug\OrionRAService' or one of its dependancies. The System cannot find the file specified. </code></pre> <p>I'm installing using visualstudio commandline, and I'm in the correct directory. I know the file exists because I can phisically see it in my file browser. <img src="https://i.stack.imgur.com/fjgtP.png" alt="enter image description here"> Below is my Service's code (at least the parts for a service, anything left out is computations and stuffs):</p> <pre><code>using System; using System.Runtime.Serialization; using System.Collections.Generic; using System.ComponentModel; using System.ServiceModel; using System.ServiceProcess; using System.Configuration; using System.Configuration.Install; using System.IO; using System.Xml; using System.Xml.Linq; namespace OrionRAService { // Define a service contract. [ServiceContract(Namespace = "http://OrionRAService")] public interface ICalculator { [OperationContract] List&lt;Profile&gt; CollectAllProfiles(); [OperationContract] bool IsItActive(Profile P); [OperationContract] void ChangeProfileActivity(Profile p,bool isActive); [OperationContract] void ChangeDaysToKeepData(int DayCount); //[OperationContract] //void CollectOnActiveProfiles(DateTime startTake, DateTime endTake); } [DataContract] public class Profile { //... ... ... } public class CalculatorService : ICalculator { //implementation of all methods from ICalculator } public class CalculatorWindowsService : ServiceBase { //... ... ... public ServiceHost mHost = null; //... ... ... public CalculatorWindowsService() { // Name the Windows Service ServiceName = "OrionRAService"; } public static void Main() { ServiceBase.Run(new CalculatorWindowsService()); } protected override void OnStart(string[] args) { if (mHost != null) { mHost.Close(); } mHost = new ServiceHost(typeof(CalculatorService), new Uri("net.pipe://localhost")); mHost.AddServiceEndpoint(typeof(ICalculator), new NetNamedPipeBinding(), "MyServiceAddress"); mHost.Open(); //... ... ... } protected override void OnStop() { if (mHost != null) { mHost.Close(); mHost = null; } } } // Provide the ProjectInstaller class which allows // the service to be installed by the Installutil.exe tool [RunInstaller(true)] public class ProjectInstaller : Installer { private ServiceProcessInstaller process; private ServiceInstaller service; public ProjectInstaller() { process = new ServiceProcessInstaller(); process.Account = ServiceAccount.LocalSystem; service = new ServiceInstaller(); service.ServiceName = "OrionRAService"; Installers.Add(process); Installers.Add(service); } } } </code></pre> <p>Here is the App.Config:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;!-- This section is optional with the new configuration model introduced in .NET Framework 4. --&gt; &lt;service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="CalculatorServiceBehavior"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8000/ServiceModelSamples/service"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;!-- this endpoint is exposed at the base address provided by host: http://localhost:8000/ServiceModelSamples/service --&gt; &lt;endpoint address="" binding="wsHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator" /&gt; &lt;!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex --&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="CalculatorServiceBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;serviceDebug includeExceptionDetailInFaults="False"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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