总目录
一、前言
本文通过从项目创建到部署,简单介绍Asp.Net Core。
二、环境
1.Visual Studio 2017
2.Asp.Net Core 2.2
三、开局
第一手:创建项目
![](http://upload-images.jianshu.io/upload_images/15438192-ff982f745db3652a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-4fd7daaf10e0685e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
1.这里选择.Net Core,.Net Core与.Net Framework选项的区别:
-面向.Net Core的ASP.NET Core应用可以跨平台;
-面向.NET Framework 的 ASP.NET Core应用无法跨平台,仅在Windows上运行。
2.这里选择【Web 应用程序(模型视图控制器)】模板,经典MVC(Model-View-Controller)。
![](http://upload-images.jianshu.io/upload_images/15438192-7918473b41555b7b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
Asp.Net Core 2.2项目结构如上,简单介绍:
-Program.cs:包含Web应用入口Main方法;
-Startup.cs:添加服务和配置Http请求管道等;
-wwwroot:包含css、images、js等资源;
-Controllers:处理请求;
-Models:数据模型;
-Views:显示数据;
-appsettings.json:默认配置文件;
第二手:运行项目
![](http://upload-images.jianshu.io/upload_images/15438192-4754079bf9cc1682.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
这里选择程序直接启动,此法会在命令行窗口打印程序运行的日志信息。
![](http://upload-images.jianshu.io/upload_images/15438192-cd521fe009381c9e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-d8fefea8c9ce67d3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
第三手:项目简介
![](http://upload-images.jianshu.io/upload_images/15438192-877296f2bc79c83b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-96070d913dc84ed0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-63ed18c62f8502d8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
第四手:项目发布
![](http://upload-images.jianshu.io/upload_images/15438192-79ad3c0be609fcbd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-ec925ba347e96d8d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-d5206e37af07b16d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
第五手:项目部署
![](http://upload-images.jianshu.io/upload_images/15438192-d8a43cef3b6e496e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-7491616abd411410.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-fa3d059d87777933.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
1.点击【浏览 *.8080(http)】即可浏览HelloCore网站;
2.若没安装.Net Core Runtime 会报错;
3..Net Core Runtime 下载地址:https://www.dotnet.microsoft.com/download
![](http://upload-images.jianshu.io/upload_images/15438192-8a265498bd302b65.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
![](http://upload-images.jianshu.io/upload_images/15438192-4827e2221e8f1b78.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/620/format/webp)
四、终局
本文介绍 Asp.Net Core项目从创建到部署,下局介绍Program,待续...
总目录
作者:dotNET之家
链接:https://www.jianshu.com/p/9c9750e23b3e
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。