Base solution for your next web application
Open Closed

Unable to use UseWindowsService middleware with aspnetzero #8172


User avatar
0
mhrabak created

Hi guys, We are trying to configure our app to run as Windows service but we are unable to run aspnetzero as WindopwsService. The error we get when try to run app is this:

ConfigureServices returning an System.IServiceProvider isn't supported.

I found out that this problem occurs because of CastleWindsor which does not support .NET Core 3 approach. Some possible unofficial approach found here: https://github.com/castleproject/Windsor/issues/493 Do you plan to try it out or do you have any advice how to run app as WindowsService in .net core 3? We tried this approach (it is just simplified version to show you the direction nto the path):

public static void Main(string[] args) {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .UseWindowsService()             
                .ConfigureWebHostDefaults(webBuilder => {
                    webBuilder.UseStartup<Startup>();
                });
    }

Thanks a lot.


1 Answer(s)
  • User Avatar
    0
    musa.demir created

    You can follow progress in these issues. https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4976 https://github.com/volosoft/castle-windsor-ms-adapter/issues/35