Running ASP.NET Core applications on Windows Subsystem for Linux
Setting up Linux on Windows 10
First thing is to enable Windows Subsystem for Linux. It doesn’t install Linux but gets Windows ready for it. Linux support is Windows feature and it must be activated from Windows Features dialog.

After installing the feature Windows needs restart.
As Windows is ready to host Linux now it’s time to install one. Windows 10 Fall Creators Update supports more than one Linux. I opened Store app and installer Ubuntu Linux from there.![]()
It takes time to get things up and running as after installation there are some configuring needed. User is asked for username and password and everything else is done by Linux from this point. Just wait until it gets done.
Running Linux on Windows
After installing Linux it is possible to use Windows 10 search to run it.

Those who need to run it frequently can also pin Ubuntu to taskbar or start menu.
Installing .NET Core
As I installed Ubuntu Linux then .NET Core installation commands here are for Ubuntu 16 that came from Windows Store.
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install dotnet-sdk-2.0.2
It takes some minutes to get .NET Core installed as after installation it also initializes things.
Running application from local disk
Linux on Windows uses its own file system and disks on machine are visible through mounting. The following screenshot shows how I moved to project folder on test machine and ran ASP.NET Core application. It’s the same folder where I build application on Visual Studio.
![]()
And here is the web front-end of my TemperatureStation solution served by Linux on Windows.
![]()
NB! I have experienced some issues this far. Sometimes after running ASP.NET Core web application on Ubuntu it’s not possible to close terminal. When closing it from Task Manager then on next run terminal window opens but nothing happens there. In case of any issues please report problems to Windows team using Feedback app.
Wrapping up
Windows subsystem for Linux is easy to enable and install. It makes Linux available on Windows without hardware level virtualization and there’s no need to install Hyper-V or some other virtualization platform. When building multi-platform apps it is handy to have Linux environment available to test and try application quickly. Although I faced few issues when working with .NET Core on Linux this way these issues were not show stoppers and I got my tasks done. Those who build multi-platform apps should give a Linux on Windows a good try.
Running ASP.NET Core applications on Windows Subsystem for Linux的更多相关文章
- [转]Publishing and Running ASP.NET Core Applications with IIS
本文转自:https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications- ...
- Asp.Net Core 自动适应Windows服务、Linux服务、手动启动时的内容路径的扩展方法
public static IWebHostBuilder UseContentRootAsEnv(this IWebHostBuilder hostBuilder) { bool IsWindows ...
- 发布到ASP.NET CORE项目到 Windows server 2012
原文: https://github.com/zeusro/MarkdownBlog/blob/master/2018/2018-01-17-01.md 发布到ASP.NET CORE项目到 Wind ...
- ASP.NET Boilerplate 学习 AspNet Core2 浏览器缓存使用 c#基础,单线程,跨线程访问和线程带参数 wpf 禁用启用webbroswer右键菜单 EF Core 2.0使用MsSql/MySql实现DB First和Code First ASP.NET Core部署到Windows IIS QRCode.js:使用 JavaScript 生成
ASP.NET Boilerplate 学习 1.在http://www.aspnetboilerplate.com/Templates 网站下载ABP模版 2.解压后打开解决方案,解决方案目录: ...
- ASP.NET Core 新建项目(Windows) - ASP.NET Core 基础教程 - 简单教程,简单编程
原文:ASP.NET Core 新建项目(Windows) - ASP.NET Core 基础教程 - 简单教程,简单编程 ASP.NET Core 新建项目(Windows) 对于任何语言和框架,都 ...
- asp.net core 托管到windows服务,并用iis做反向代理
使用NSSM把.Net Core部署至 Windows 服务 为什么部署至Windows Services 在很多情况下,很少会把.Net Core项目部署至Windows服务中,特别是Asp.n ...
- WSL(Windows Subsystem for Linux)--Pico Process Overview
[转载] Windows Subsystem for Linux -- Pico Process Overview Overview This post discusses pico processe ...
- Build SSH for Development on Windows Subsystem for Linux
It seems that Windows Subsystem for Linux (WSL) is getting much more mature than the time when it fi ...
- Windows10上开启WSL2(Windows Subsystem for Linux 2)及Docker Desktop For Windows
什么是WSL2 WSL2(Windows Subsystem for Linux 2)是适用于Linux的Windows子系统体系结构的一个新版本,它支持适用于Linux的Windows子系统在Win ...
随机推荐
- 江苏省选2019Round1游记
JSOI2019R1过去了. Day0 打板子.看白书. 晚上太热了,楼下还在打铁,睡不着. 折腾到好晚才勉强睡着. Day1 早上好困啊. 开T1.看起来T1的60分很可做的样子?5min打完了(为 ...
- Java IO(五)——字符流进阶及BufferedWriter、BufferedReader
一.字符流和字节流的区别 拿一下上一篇文章的例子: package com.demo.io; import java.io.File; import java.io.FileReader; impor ...
- vue 图片切换动态绑定
<img :src="切换条件 ? require('xxx.png') : require('xxx.png')" />
- "INSTALL_FAILED_DUPLICATE_PERMISSION "错误解决
我们在进行Android组件安全测试时,如果遇到声明了权限的组件,在编写PoC时,可能会遇到如下错误提示: INSTALL_FAILED_DUPLICATE_PERMISSION perm=com.m ...
- Scala学习(九)练习
文件正则表达式&练习 1. 编写一小段Scala代码,将某个文件中的行倒转顺序,将最后一行作为第一行,依此类推 程序代码: import scala.io.Source import java ...
- Python-sys模块-61
sys 模块:和Python解释器打交道的模块 sys模块是与python解释器交互的一个接口 sys.argv 命令行参数List,第一个元素是程序本身路径 sys.exit(n) 退出程序,正常退 ...
- BZOJ4289 Tax 最短路建模
给定一个带边权的无向图,求1到n的最小代价路径.经过一个点的代价是路径上这个点的入边和出边的较大权值. \(n \le 100000, m \le 200000\). 一般的建图是考虑每个点,其入边和 ...
- D. Nastya Is Buying Lunch
链接 [https://codeforces.com/contest/1136/problem/D] 题意 有N个人,a[i]表示第i个人的编号,m个二元组. 当前一个在后一个的前面一个位置时二者可以 ...
- c++入门之类——进一步剖析
通常的,关于一个类,包含了下面几个方面: 1 声明类成员和接口:2 定义类接口函数(方法)3通过接口调用类 下面先给出第一条:声明类成员和接口 # ifndef MYTIME0_H_ # defin ...
- shell正则表达
shell正则表达 .*和.?的比较: 比如说匹配输入串A: 101000000000100 使用 1.*1 将会匹配到1010000000001,匹配方法:先匹配至输入串A的最后, 然后向前匹配,直 ...