[英]is it possible to run windows service / app (c#) on heroku platform?
I am checking the possibility to run my C# service on the Heroku platform...我正在检查在 Heroku 平台上运行我的 C# 服务的可能性......
Does anyone have an experience with such a solution?有没有人有这种解决方案的经验?
There are some Heroku buildpacks for that use Mono to run .NET and C#.有一些 Heroku 构建包用于使用 Mono 运行 .NET 和 C#。 Here's the one that I built: https://github.com/friism/heroku-buildpack-mono
这是我构建的: https : //github.com/friism/heroku-buildpack-mono
You could create a Dockerfile to generate a Docker image runnable on Heroku.您可以创建一个 Dockerfile 来生成可在 Heroku 上运行的 Docker 映像。
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
CMD ASPNETCORE_URLS=http://*:$PORT dotnet <YOUR_API_NAME>.dll
Then you can publish it to Heroku either directly using these Docker commands:然后你可以直接使用这些 Docker 命令将它发布到 Heroku:
docker build -t aspnetapp <YOUR_API_NAME>
docker login --username=$HEROKU_USERNAME --password=$HEROKU_API_KEY registry.heroku.com
docker tag aspnetapp registry.heroku.com/$HEROKU_APP_NAME/web
docker push registry.heroku.com/$HEROKU_APP_NAME/web
In order these commands:为了这些命令:
However, if your machine does not support Docker, you can also use CircleCI to run these commands.但是,如果您的机器不支持 Docker,您也可以使用 CircleCI 来运行这些命令。 More details here: https://www.codingnagger.com/2018/02/21/continuous-delivery/
更多细节在这里: https : //www.codingnagger.com/2018/02/21/continuous-delivery/
There is now an official Heroku buildpack for building ASP.NET 5 (Core) apps using project.json files and the kpm package manager.现在有一个官方的Heroku 构建包,用于使用 project.json 文件和 kpm 包管理器 构建 ASP.NET 5 (核心)应用程序。 Mono is bundled for runtime execution.
Mono 被捆绑用于运行时执行。
Example usage:用法示例:
$ heroku create --buildpack http://github.com/heroku/dotnet-buildpack.git
$ git push heroku master
The buildpack will detect your app as ASP.NET 5 if it has project.json.如果您的应用程序具有 project.json,则 buildpack 会将您的应用程序检测为 ASP.NET 5。 If the source code you want to build contains multiple project.json files, you can use a .deployment or set a $PROJECT config var to control which one is built.
如果您要构建的源代码包含多个 project.json 文件,您可以使用 .deployment 或设置 $PROJECT 配置变量来控制构建哪个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.