1. Web API.

    看这篇文章:

    https://docs.microsoft.com/en-us/aspnet/mvc/overview/deployment/docker-aspnetmvc

  2. Windows service.

    看这篇文章https://stackoverflow.com/questions/39705529/console-app-or-windows-service-in-windows-container

    一个docker container就是一个service,可以把windows service改写成exe, 然后在docker container里面一直运行这个exe, container启动了就等于service启动了,container停止了就等于service停止了。

No, you don't want to install it as a service. When you run an application in a container, Docker monitors the active process in the container. If the active process stops, the container exits. So you should run your app in the foreground, and let Docker put the container in the background (by starting it with docker run -d).

An exception is where the existing platform is already a Windows Service - e.g. the microsoft/iisimage. IIS is running in the background in the container, so you need to start another process to keep the container running - which is why you see IIS containers started like this:

docker run -d -p 80:80 microsoft/iis ping -t localhost

The ping command keeps the container running, while the IIS service actually responds to requests. This is not ideal though, Docker is monitoring ping so if the IIS service stops the container keeps running.

继续看第三点如何将Exe部署到docker上面去。

  1. Windows application.

    看这篇文章: https://hub.docker.com/r/microsoft/dotnet-framework/

  2. 这里是如何在docker上部署一个.net的console application: https://docs.microsoft.com/en-us/dotnet/framework/docker/console

如何将.NET 4.0写的Windows service和Web API部署到docker上面的更多相关文章

  1. windows service宿主web api使用"依赖注入"和“控制反转”的技术实践

    前言 自从几年前抛弃wcf,使用web api 来做服务器端开发之后,就不再迷惑了.但是因为本来从事传统行业管理软件开发,一般都以分布式应用开发为主.纯BS还是比较少,于是比较喜欢用windows s ...

  2. 返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, .net 4.5 带来的更方便的异步操作

    原文:返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, ...

  3. Windows Service的转换与部署

    开发Windows Service,可能会碰到以下两种情况. 1. 直接开发一个Windows Service 网上有很多教程,可以参考这个: http://www.cnblogs.com/sorex ...

  4. Web APi 2.0优点和特点?在Web APi中如何启动Session状态?

    前言 曾几何时,微软基于Web服务技术给出最流行的基于XML且以扩展名为.asmx结尾的Web Service,此服务在.NET Framework中风靡一时同时也被.NET业界同仁所青睐,几年后在此 ...

  5. 主攻ASP.NET MVC4.0之重生:ASP.NET MVC Web API

    UserController代码: using GignSoft.Models; using System; using System.Collections.Generic; using Syste ...

  6. C#写Windows Service(windows服务程序)

    背景:        要学习使用一个新东西,我们必须知道他是个什么东西.对于我们此次研究的windows服务来说,他又是个什么东西,其实也没有什么高深的了. windows service概述: 一个 ...

  7. C#制作Windows service服务系列二:演示一个定期执行的windows服务及调试(windows service)

    系列一: 制作一个可安装.可启动.可停止.可卸载的Windows service(downmoon原创) 系列二:演示一个定期执行的windows服务及调试(windows service)(down ...

  8. 关于Windows Service的一个编写技巧

    写过Windows Service的朋友都知道服务是不可以直接在vs里面启动调试,我们必须修改Program.cs文件来达到我们调试的目的,等服务调试好了以后还要把代码改回来,显非常的不方便,在这里为 ...

  9. asp.net core 2.0 web api基于JWT自定义策略授权

    JWT(json web token)是一种基于json的身份验证机制,流程如下: 通过登录,来获取Token,再在之后每次请求的Header中追加Authorization为Token的凭据,服务端 ...

随机推荐

  1. LPC43xx SGPIO Slice 示意图

    SGPIO inverted clock qualifier Hi, With bits 6:5 of SGPIO_MUX_CFG the QUALIFIER_MODE is selected (0x ...

  2. 北大 ACM 分类 汇总

    1.搜索 //回溯 2.DP(动态规划) 3.贪心 北大ACM题分类2009-01-27 1 4.图论 //Dijkstra.最小生成树.网络流 5.数论 //解模线性方程 6.计算几何 //凸壳.同 ...

  3. Make the DbContext Ambient with UnitOfWorkScope(now named DbContextScope by mehdime)

    The Entity Framework DbContext (or LINQ-to-SQL DataContext) is a Unit Of Work implementation. That m ...

  4. 这里包含几乎所有的xcode正式版本

    https://developer.apple.com/downloads/

  5. 总结ASP.NET MVC视图页使用jQuery传递异步数据的几种方式

    在ASP.NET MVC的视图页向控制器传递异步数据,可能是数组,JavaScript对象,json,表单数据,等等. 关于数据,JavaScript对象有时候和json长得一模一样,有么有? var ...

  6. 添加类似navigationController自带的返回按钮

    添加类似navigationController自带的返回按钮,效果如下: 一.UINavigationcontroller自带的navigationBar 是无法添加左箭头的返回按钮的 在网上搜索了 ...

  7. Mac 安装zsh

    1.安装zsh mac下自带zsh,但不是最新.查看zsh版本:zsh --version如果没有安装, 可以通过brew安装最新版,brew install zsh 2.安装oh-my-zsh cd ...

  8. 使用系统自带的 UIRefreshControl 实现下拉刷新

    UIRefreshControl 为 UITableViewController 中的一个属性,从以下可以看出, IOS6.0 以上才支持. @property (nonatomic,retain) ...

  9. IOS的唯一标识符问题(转)

    引用地址 http://www.zhihu.com/question/22599526/answer/21938878 网上搜了下IOS手机标志的种类,直接引用过来. UDID [[UIDevice ...

  10. linux配置nginx

    相关命令: nginx -s reload  :修改配置后重新加载生效 nginx -s reopen  :重新打开日志文件nginx -t -c /path/to/nginx.conf 测试ngin ...