小编cod*_*ode的帖子

启动我的应用程序时无法访问 swagger UI

我正在使用 ASP.NET core 6,并使用 React 选项创建了我的应用程序(所以我的文件夹中有一个 ClientApp)。

当我运行该应用程序时,我将看到我的 React UI,而看不到 swagger UI。

通常,当您选择从两个不同的文件夹构建时frontendbackend如果您在 Visual Studio 上运行后端,您将看到 swagger UI。

但现在我只看到我的反应应用程序用户界面。https://localhost:44434/swagger我正在尝试使用或访问 swagger https://localhost:44434/swagger/index.html,但它只是停留在我的 React 应用程序 UI 页面上。

这是我尝试设置它的视频:

https://www.youtube.com/watch?v=RvwvFmO-56E

任何想法 ?多谢 !

这是我的program.cs代码:

    using BugTracker.Context;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

// Add services to the container.

builder.Services.AddControllersWithViews();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();


// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{

    // The default HSTS value is 30 …
Run Code Online (Sandbox Code Playgroud)

swagger asp.net-core asp.net-core-6.0

9
推荐指数
1
解决办法
7365
查看次数

标签 统计

asp.net-core ×1

asp.net-core-6.0 ×1

swagger ×1