当前位置:网站首页>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
边栏推荐
- MongoDB主配置文件
- 2020-01-01t00:00:00.000000z date format conversion
- Ansible introduction [unfinished (semi-finished products)]
- js中#号的作用
- 简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息
- [set theory] partial order relation (partial order relation definition | partial order set definition | greater than or equal to relation | less than or equal to relation | integer division relation |
- 动态规划:最长回文子串和子序列
- 900w+ data, from 17s to 300ms, how to operate
- MongoDB复制集【主从复制】
- Half of 2022 is over, so we must hurry up
猜你喜欢
Ffmpeg one / more pictures synthetic video
Pytoch lightweight visualization tool wandb (local)
Elsevier latex submitted the article pdftex def Error: File `thumbnails/cas-email. jpeg‘ not found: using draf
pytorch项目怎么跑?
Learning notes of C programming [compiled by Mr. Tan Haoqiang] (Chapter III sequence programming) 04 C sentence
Limit of one question per day
IPv6过渡技术-6to4手工隧道配置实验--尚文网络奎哥
Ffmpeg recording screen and screenshot
Role of JS No
Without sxid, suid & sgid will be in danger- Shangwen network xUP Nange
随机推荐
Recursive use and multi-dimensional array object to one-dimensional array object
User value is the last word in the competition of mobile phone market
Separable bonds and convertible bonds
如何迈向IPv6之IPv6过渡技术-尚文网络奎哥
Positioning (relative positioning, absolute positioning, fixed positioning, Z-index) 2022-2-11
释放数据力量的Ceph-尚文网络xUP楠哥
Application of derivative in daily question
pytorch怎么下载?pytorch在哪里下载?
FileZilla Client下载安装
softmax的近似之NCE详解
[mathematical logic] propositions and connectives (propositions | propositional symbolization | truth connectives | no | conjunction | disjunction | non truth connectives | implication | equivalence)
Avec trois. JS fait une scène 3D simple
Captura下载安装及在Captura配置FFmpeg
用Three.js做一個簡單的3D場景
redis高级应用【密码防护、数据持久化、主从同步、哨兵模式、事务】【暂未完成(半成品)】
【全民编程】《软件编程-讲课视频》【零基础入门到实战应用】
小程序获取用户头像和昵称
递归:深度优先搜索
Without sxid, suid & sgid will be in danger- Shangwen network xUP Nange
Numpy warning visibledeprecationwarning: creating an ndarray from ragged needed sequences