当前位置:网站首页>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

边栏推荐
- leetcode:动态规划模板
- Mongodb master profile
- 如何迈向IPv6之IPv6过渡技术-尚文网络奎哥
- [leetcode question brushing day 34] 540 Unique element in array, 384 Disrupt array, 202 Happy number, 149 Maximum number of points on a line
- ffmpeg录制屏幕和截屏
- Mysql Mac版下载安装教程
- 小程序获取用户头像和昵称
- Ansible简介【暂未完成(半成品)】
- MongoDB主配置文件
- Half of 2022 is over, so we must hurry up
猜你喜欢

Limit of one question per day

Elsevier latex submitted the article pdftex def Error: File `thumbnails/cas-email. jpeg‘ not found: using draf
![C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 05 data input and output](/img/38/9c460fc58b62609dd02e7c61207ae6.jpg)
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 05 data input and output

Hutool dynamically adds scheduled tasks

TCP, the heavyweight guest in tcp/ip model -- Kuige of Shangwen network

UMI route interception (simple and rough)

ffmpeg录制屏幕和截屏

Application of derivative in daily question

navicat 导出数据库的表结构

Nce detail of softmax approximation
随机推荐
【学习笔记】seckill-秒杀项目--(11)项目总结
The series of hyperbolic function in daily problem
Avec trois. JS fait une scène 3D simple
Download and install captura and configure ffmpeg in captura
MySQL MAC download and installation tutorial
Use three JS make a simple 3D scene
Error in compiled file: error: unmapped character encoding GBK
Message queue addition failure
Applet (continuous update)
MongoDB基本操作【增、删、改、查】
Learning notes of C programming [compiled by Mr. Tan Haoqiang] (Chapter III sequence programming) 04 C sentence
Recursion: one dimensional linked lists and arrays
Debug: CD cannot be used in kaggle
渤、黄海的潮汐特征
Filter
How to move towards IPv6: IPv6 Transition Technology - Shangwen network quigo
Web会话管理安全问题
VS克隆时显示403错误
Recursion: quick sort, merge sort and heap sort
编译文件时报错:错误: 编码GBK的不可映射字符