I am currently trying to deploy a DotNetCore app on a Ubuntu16.04 vm on Azure by following this tutorial: https://learn.microsoft.com/en-us/aspnet/core/publishing/linuxproduction
After deploying the contents of the folder produced by dotnet publish
to the vm .... if I manually go into the project folder and start Kestrel via dotnet app_name.dll
, it works perfectly and I'm able to access the application from a browser.
The output I get from the terminal after running dotnet app_name.dll
manually is
Hosting environment: Production
Content root path: /home/myUser/publish
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Now, the tutorial wants me use SystemD to manage the Kestrel process.
It runs dotnet
for us via
ExecStart=/usr/bin/dotnet /var/aspnetcore/app_name.dll
. in the service file
When I start the service, it looks like it's going to work. I get:
Hosting environment: Production
Content root path: /
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
... but kestrel never get's the request when I try to access the app. The only difference I'm seeing between the two is the Content root path
.
Now, in the project the path is referenced in startup.cs:
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath ....
I tried hardcoding the string value, but that didn't actually change anything...
So, is the culprit for my web app not working under systemD the Content root path
?
If so, how can I fix this? If not, are there any other issues that I should be aware of?