RSh
RSh

Reputation: 11

How do I start a .NET console app on CloudFoundry?

We are trying to trying to convert some Windows services in our application to console apps so we can push them onto CF. While trying with a sample .net console app, I am getting the following error:

2018-09-26T14:36:42.92+0530 [APP/PROC/WEB/0] ERR Error: no start command specified during staging or launch
2018-09-26T14:36:43.98+0530 [APP/PROC/WEB/0] OUT Exit status 1
2018-09-26T14:36:55.72+0530 [CELL/0] OUT Cell f80753e2-393c-411d-a662-6a49de7e44ce stopping instance a86af9f8-11f0-41ad-7f84-f518
2018-09-26T14:36:55.72+0530 [CELL/0] OUT Cell f80753e2-393c-411d-a662-6a49de7e44ce destroying container for instance a86af9f8-11f0-41ad-7f84-f518
2018-09-26T14:36:55.73+0530 [API/1] OUT Process has crashed with type: "web"
2018-09-26T14:36:55.77+0530 [API/1] OUT App instance exited with guid b9260f94-1097-4cf1-b181-a5ce1a2aa02e payload: {"instance"=>"a86af9f8-11f0-41ad-7f84-f518", "index"=>0, "cell_id"=>"f80753e2-393c-411d-a662-6a49de7e44ce", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1; process did not exit", "crash_count"=>2, "crash_timestamp"=>1537952815635562745, "version"=>"a53c5691-7d64-4030-82f0-91a85ead97b5"}*

I used this command to push the app onto CF:

cf push CloudConsoleApp --health-check-type none -s windows2016 -b binary_buildpack --no-route

I am able to push a .Net core console app and keep it running on the same CF instance. Could someone please tell me what I am missing here?

Upvotes: 1

Views: 1691

Answers (2)

Alberto Gurrion
Alberto Gurrion

Reputation: 116

I did a poc using this statement and worked

cf push SimpleConsole --health-check-type none --no-route -s windows2016 -b hwc_buildpack -p .\Release -c SimpleConsole.exe

Release path contains the exe file and -c parameter must have the command that cf runtime will run. hwc.exe is a wrapper around Hosted Web Core API i added web.config as a clone of application.config. Hope it helps.

Upvotes: 0

Daniel Mikusa
Daniel Mikusa

Reputation: 15006

A couple things you could try...

cf push CloudConsoleApp --health-check-type none -s windows2016 -b binary_buildpack --no-route

In the past, you needed to use the binary_buildpack. That's not true anymore, although you can still use it. In general, you should use the hwc_buildpack with .NET Apps on Windows.

Try cf push CloudConsoleApp --health-check-type none -s windows2016 --no-route -b hwc_buildpack.

If that doesn't work, you can still use the binary_buildpack, but the binary_buildpack does nothing. It doesn't install anything, it doesn't know how to build your app, it does not know how to run your app. Thus, if the hwc_buildpack doesn't work for you then you need to also specify a command to start your app. So, try something like this: cf push CloudConsoleApp --health-check-type none -s windows2016 -b binary_buildpack --no-route -c 'my_app.exe' (or whatever command runs your app).

With the binary buildpack, you also need to push an app that's compiled and ready to run. The binary buildpack does nothing, not even compile your app, whereas the hwc_buildpack knows more and can build your app.

Hope that helps!

Upvotes: 3

Related Questions