Reputation: 1
I have a Winodws Service Solution that works fine in a Windows 10, but it does not start in a Windows Server 2012R2 or a Windows Server 2018
If I seek in Windows Events I get this FileNotFoundExceptionError:
Aplicación: ServicioWindowsPrueba.exe
Versión de Framework: v4.0.30319
Descripción: el proceso terminó debido a una excepción no controlada.
Información de la excepción: System.IO.FileNotFoundException
en Microsoft.Owin.Hosting.Services.ServicesFactory.DoCallback(System.Action2<System.Type,System.Type>) en Microsoft.Owin.Hosting.Services.ServicesFactory.DoCallback(System.Collections.Generic.IDictionary
2<System.String,System.String>, System.Action2<System.Type,System.Type>) en Microsoft.Owin.Hosting.Services.ServicesFactory.Create(System.Collections.Generic.IDictionary
2<System.String,System.String>, System.Action`1<Microsoft.Owin.Hosting.Services.ServiceProvider>)
en Microsoft.Owin.Hosting.WebApp.BuildServices(Microsoft.Owin.Hosting.StartOptions)
en Microsoft.Owin.Hosting.WebApp.Start(Microsoft.Owin.Hosting.StartOptions)
en Microsoft.Owin.Hosting.WebApp.Start[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]
en RestOwin.RestOwinServidor.Start()
en System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
en System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
en System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
en System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
en System.Threading.ThreadHelper.ThreadStart()
this is my Startup class:
using Owin;
using System.Web.Http;
namespace RestOwin
{
public class Startup
{
// This code configures Web API. The Startup class is specified as a type
// parameter in the WebApp.Start method.
public void Configuration(IAppBuilder appBuilder)
{
// Configure Web API for self-host.
HttpConfiguration config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}"
//routeTemplate: "{controller}/{id}",
//defaults: new { id = RouteParameter.Optional }
);
appBuilder.UseWebApi(config);
}
}
}
and this is my Server Class:
using System;
using Microsoft.Owin.Hosting;
using System.Net.Http;
namespace RestOwin
{
public class RestOwinServidor
{
//Puerto de escucha
public int port { get; set; }
public void Start()
{
//try
//{
string baseAddress = "http://127.0.0.1:" + port + "/";
// Start OWIN host
WebApp.Start<Startup>(url: baseAddress);
}
}
}
Upvotes: 0
Views: 207
Reputation: 1
It is solved. It was my fault, I was only copying the .dll an .exe file to Windows Server and I left the rest of the files that are also important
Upvotes: 0