当前位置:网站首页>In Net 6 project using startup cs
In Net 6 project using startup cs
2022-07-03 03:47:00 【Dotnet cross platform】

about .NET 6 project , Now I can't find Startup.cs file . By default , This file has been deleted , also Program.cs Is to configure dependency injection services and Middleware New location for .
however , Some people may prefer to use Startup.cs , And I am also , Maybe I'm used to it , So in this article , I will be in .NET 6 Add to the project Startup.cs.
Use .NET 6 project , Program.cs The file will probably look like this , Adding services and using middleware are among them .

Now? , Let's add one manually Startup.cs file , And write the following code

We should all be familiar with these codes , Which includes ConfigureService() and Configure() Method , And added some services , And the use of middleware .
Next , We need to change it Program.cs file , Use our new Startup.cs.

It looks good ! Compared with before , It has become very concise !
Of course , You can also use other method names , For example ConfigureService Switch to RegisterServices, hold
Configure Switch to SetupMiddleware, as follows

Now? , Familiar old friends Startup.cs Back again !
END

边栏推荐
- Limit of one question per day
- [mathematical logic] normal form (conjunctive normal form | disjunctive normal form | major item | minor item | maximal item | minor item | principal conjunctive normal form | principal disjunctive no
- 递归:快速排序,归并排序和堆排序
- VS克隆时显示403错误
- [DRM] simple analysis of DRM bridge driver call process
- [embedded module] OLED display module
- Ffmpeg recording screen and screenshot
- golang xxx. Go code template
- MongoDB基本操作【增、删、改、查】
- 900w+ data, from 17s to 300ms, how to operate
猜你喜欢

如何迈向IPv6之IPv6过渡技术-尚文网络奎哥

Pytorch multi card distributed training distributeddataparallel usage

Limit of one question per day

Makefile demo

小程序获取用户头像和昵称
![[MySQL] the difference between left join, right join and join](/img/d4/8684cd59cd1bd77e70bd4d7c7074c3.jpg)
[MySQL] the difference between left join, right join and join

简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息

Avec trois. JS fait une scène 3D simple

The series of hyperbolic function in daily problem

机械臂速成小指南(八):运动学建模(标准DH法)
随机推荐
Some preliminary preparations for QQ applet development: make an appointment for a development account, download and install developer tools, and create QQ applet
js中#号的作用
SAP UI5 应用开发教程之一百零五 - SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍
UMI route interception (simple and rough)
Téléchargement et installation du client Filezilla
PHP generates PDF tcpdf
MongoDB简介
Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)
QQ小程序开发之 一些前期准备:预约开发账号、下载安装开发者工具、创建qq小程序
Recursive use and multi-dimensional array object to one-dimensional array object
shardingsphere动态数据源
可分离债券与可转债
Mongodb replication set [master-slave replication]
pytorch怎么下载?pytorch在哪里下载?
简易版 微信小程序开发之for指令、上传图片及展示效果优化
C语言HashTable/HashSet库汇总
Recursion: depth first search
Summary of determinant knowledge points in Chapter 1 of Linear Algebra (Jeff's self perception)
Table structure of Navicat export database
[combinatorics] basic counting principle (addition principle | multiplication principle)