如何使用错误代码退出aspnetcore程序?
例如执行此操作的控制台应用程序:
public class Program
{
public static void Main(string[] args)
{
Environment.Exit(1);
throw new Exception("Failed");
}
}
Dockerfile是
FROM microsoft/dotnet:1.1-runtime
ARG source
WORKDIR /app
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "Example.dll"]
容器运行时的输出是
The program '' has exited with code 0 (0x0).