How can I supervised-ise .NET Core Web App?

144 Views Asked by At

This works:

$ dotnet bin/Debug/netcoreapp1.0/aspnetcoreapp.dll &
[1] 42350
Hosting environment: Production
Content root path: /home/foo/aspnetcoreapp
Now listening on: http://localhost:8080
Application started. Press Ctrl+C to shut down.

$ curl http://localhost:8080
(returns html)

While referring https://learn.microsoft.com/en-us/aspnet/core/publishing/linuxproduction , I wrote /etc/supervisord.conf as follows:

[program:aspnetcoreapp]
directory=/home/foo/aspnetcoreapp
command=/usr/local/bin/dotnet /home/foo/aspnetcoreapp/bin/Debug/netcoreapp1.0/aspnetcoreapp.dll
enviromnent=ASPNETCORE_ENVIRONMENT=Production
user=foo
stdout_logfile=/var/tmp/aspnetcoreapp.log
stderr_logfile=/var/tmp/aspnetcoreapp.log
autostart=true

Then I start supervisord.

$ supervisorctl start

The app seems running.

$ cat /var/tmp/aspnetcoreapp.log
Hosting environment: Production
Content root path: /home/foo/aspnetcoreapp
Now listening on: http://localhost:8080
Application started. Press Ctrl+C to shut down.

But the app returns 500 error.

$ curl -v http://localhost:8080
* About to connect() to localhost port 8080 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8080
> Accept: */*
> 
< HTTP/1.1 500 Internal Server Error
< Date: Mon, 26 Dec 2016 19:38:41 GMT
< Content-Length: 0
< Server: Kestrel
< 
* Connection #0 to host localhost left intact

informations:

$ dotnet --info
.NET Command Line Tools (1.0.0-preview4-004233)

Product Information:
 Version:            1.0.0-preview4-004233
 Commit SHA-1 hash:  8cec61c6f7

Runtime Environment:
 OS Name:     centos
 OS Version:  7
 OS Platform: Linux
 RID:         centos.7-x64
 Base Path:   /opt/dotnet1.0.0-preview4-004233/sdk/1.0.0-preview4-004233
0

There are 0 best solutions below