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

边栏推荐
- Latest version of NPM: the "NPM" item cannot be recognized as the name of a cmdlet, function, script file, or runnable program. Please check
- Dynamic programming: longest common substring and longest common subsequence
- [national programming] [software programming - Lecture Video] [zero foundation introduction to practical application]
- FileZilla Client下載安裝
- [combinatorics] basic counting principle (addition principle | multiplication principle)
- Lvgl usage experience
- pytorch是什么?pytorch是一个软件吗?
- [mathematical logic] propositional logic (equivalent calculus | idempotent law | exchange law | combination law | distribution law | De Morgan law | absorption rate | zero law | identity | exclusion l
- User value is the last word in the competition of mobile phone market
- 8.8.2-PointersOnC-20220214
猜你喜欢

Elsevier latex submitted the article pdftex def Error: File `thumbnails/cas-email. jpeg‘ not found: using draf

IPv6 transition technology-6to4 manual tunnel configuration experiment -- Kuige of Shangwen network

Recursion: quick sort, merge sort and heap sort

SAP UI5 应用开发教程之一百零五 - SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍

学会pytorch能干什么?

MySQL MAC download and installation tutorial

Mongodb installation & Deployment

pytorch是什么?pytorch是一个软件吗?

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

pytorch开源吗?
随机推荐
在 .NET 6 项目中使用 Startup.cs
Error in compiled file: error: unmapped character encoding GBK
渤、黄海的潮汐特征
静态网页 和 动态网页的区别 & WEB1.0和WEB2.0的区别 & GET 和 POST 的区别
【DRM】DRM bridge驱动调用流程简单分析
Application of derivative in daily question
Hi3536c v100r001c02spc040 cross compiler installation
Basic operations of mongodb [add, delete, modify, query]
node,npm以及yarn下载安装
Open Visual Studio 2010 hangs when opening a SQL file sql file
Bid farewell to artificial mental retardation: Mengzi open source project team received RMB 100 million financing to help NLP develop
numpy之 警告VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
Nce detail of softmax approximation
如何迈向IPv6之IPv6过渡技术-尚文网络奎哥
学会pytorch能干什么?
Without sxid, suid & sgid will be in danger- Shangwen network xUP Nange
403 error displayed when vs cloning
PHP generates PDF tcpdf
用Three.js做一個簡單的3D場景
ffmpeg录制屏幕和截屏