I have hosted ASP.Net core 3.1 application in Windows Service. It works fine and I am able to navigate to pages.
Now i am trying to change deployment as single executable file from "Produce single file" option in Publish settings. after this I started getting errors 404 for static files under wwwroot folder. below are the folders and actucal values:
Directory.GetCurrentDirectory() = C:\WINDOWS\system32 - This is Correct as per documentation.
AppDomain.CurrentDomain.BaseDirectory = C:\WINDOWS\TEMP\.net\app_windows_servicename\yjzzq0br.phx\
// This should have been the installed application location.
hostingContext.HostingEnvironment.ContentRootPath= C:\WINDOWS\TEMP\.net\app_windows_servicename\yjzzq0br.phx\
// This should have been the installed application location.
This path contains extracted binaries but does not contain folder and content for wwwroot. If i manually copy wwwroot folder and content to this temp location then hosted asp.net core service under windows service serves the static files properly.
help me on this. Same behavior was observed in ASP.Net Core 3.0.1 also.