Imports Microsoft.AspNetCore.Builder
Imports Microsoft.Extensions.DependencyInjection
Imports Microsoft.Extensions.Hosting
Public Class Program
Public Shared Sub Main(args() As String)
Dim builder = WebApplication.CreateBuilder(args)
builder.Services.AddControllers() '将服务添加到容器。
builder.Services.AddEndpointsApiExplorer() '了解有关配置 Swagger/OpenAPI 的更多信息,请访问 https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddSwaggerGen()
Dim app = builder.Build()
If app.Environment.IsDevelopment() Then app.UseSwagger() : app.UseSwaggerUI()
' app.UseHttpsRedirection()
app.UseAuthorization()
app.MapControllers()
app.Run()
End Sub
End Class
本人使用vb.net 写的core net8的后端代码
本文介绍了如何在VB.NET中使用ASP.NETCore8构建后端应用,包括添加控制器、服务注册、API探索器和Swagger生成。展示了在开发环境中启用SwaggerUI的功能。
200

被折叠的 条评论
为什么被折叠?



