当前位置:网站首页>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
边栏推荐
- [AI practice] Application xgboost Xgbregressor builds air quality prediction model (I)
- Simple wechat applet development page Jump, data binding, obtaining user information, obtaining user location information
- [MySQL] the difference between left join, right join and join
- Recursive use and multi-dimensional array object to one-dimensional array object
- [learning notes] seckill - seckill project - (11) project summary
- Intercept string fixed length to array
- leetcode:动态规划模板
- Applet get user avatar and nickname
- Mongodb replication set [master-slave replication]
- MongoDB简介
猜你喜欢
在 .NET 6 项目中使用 Startup.cs
没有sXid,suid&sgid将进入险境!-尚文网络xUP楠哥
Learning notes of C programming [compiled by Mr. Tan Haoqiang] (Chapter III sequence programming) 04 C sentence
CEPH Shangwen network xUP Nange that releases the power of data
Error in compiled file: error: unmapped character encoding GBK
Ansible introduction [unfinished (semi-finished products)]
How to move towards IPv6: IPv6 Transition Technology - Shangwen network quigo
105. SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍
ffmpeg之 一张/多张图片合成视频
Nce detail of softmax approximation
随机推荐
IPv6过渡技术-6to4手工隧道配置实验--尚文网络奎哥
渤、黄海的潮汐特征
Advanced redis applications [password protection, data persistence, master-slave synchronization, sentinel mode, transactions] [not completed yet (semi-finished products)]
node,npm以及yarn下载安装
Tidal characteristics of the Bohai Sea and the Yellow Sea
C # webrequest post mode, based on "basic auth" password authentication mode, uploads files and submits other data using multipart / form data mode
Makefile demo
[mathematical logic] propositional logic (propositional and connective review | propositional formula | connective priority | truth table satisfiable contradiction tautology)
Mongodb master profile
Hi3536c v100r001c02spc040 cross compiler installation
TCP, the heavyweight guest in tcp/ip model -- Kuige of Shangwen network
[leetcode question brushing day 34] 540 Unique element in array, 384 Disrupt array, 202 Happy number, 149 Maximum number of points on a line
@The difference between Autowired, @qualifier, @resource
redis在服务器linux下的启动的相关命令(安装和配置)
Debug: CD cannot be used in kaggle
Convert binary stream to byte array
[mathematical logic] propositional logic (equivalent calculus | idempotent law | exchange law | combination law | distribution law | De Morgan law | absorption rate | zero law | identity | exclusion l
numpy之 警告VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
Ansible introduction [unfinished (semi-finished products)]
pytorch怎么下载?pytorch在哪里下载?