C#利用.Net8.0新建站Mvc项目及支持Swagger服务的操作方法
1、建.NET8.0MVC、API项目
1.1、新建项目模板选择ASP.NET Core Web API(用于使用ASP.NET Core控制器或最小API创建 RESTful Web API的项目模板)进行创建。选择好后点下一步;
1.2、设置好项目名称及项目所在的目录点下一步;
1.3、根据需要框架选择8.0,去掉配置HTTPS前的选择,及选择启用OpenAPIf支持(Swagger)、不使用顶级语句、使用控制器三项再点“创建”完成项目的创建,即完成项目的初始化新建;
2、新建web.config文件,确保文件的内容如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section. For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<!-- -->
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnab