I am experimenting with gRpc and have it running. I am using .net core 3.1. C# . I am now attempting to install it as a windows service. The machine is Win 10 Pro x64 .
I added the line as instructed to run it as a windows service...
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
//https://docs.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/self-hosted
.UseWindowsService() // Enable running as a Windows service
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
I publish to a folder (I never have used publish before) and voila... there is the publish folder. I go to that folder and run (AS ADMINISTRATOR) installutil. Yes it found the utility as i used the full path. That path is
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe"
Is this correct version to run for .net core? Does that matter?
So I run installutil {full-path-to}\grpcservice1.exe
I get...
Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'file:///....\GrpcService1\GrpcService1\bin\Debug\netcoreapp3.1\publish\GrpcService1.exe' or one of its dependencies. The module was expected to contain an assembly manifest..
I can't figure out what I am doing wrong.... Suggestions? I just following the example.
TIA