admin管理员组文章数量:1026989
My project builds successfully, but on publishing to Azure this error occurs:
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Be sure that the Startup.cs for your application is calling AddSwaggerGen from within ConfigureServices in order to generate swagger file. Visit /?LinkId=2131205&CLCID=0x409 for more information.
at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.EmitTerminatingError(String bucketName, String displayedErrorMessage, String loggedErrorMessage) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<GenerateSwaggerToBuildOutputDirAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<RunUpdateAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.<RunUpdateWithTelemetryAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.<UpdateApiMApiAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.NewFx.Profiles.BaseSwaggerPublishStep.<RunAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Publish.Framework.Profiles.ProjectProfilesManager.<RunPublishStepsAsync>d__44.MoveNext()
I am using .NET 8 and Visual Studio 2024 and I am registering the Swagger UI in my application.
here is my program.cs file
using Application.Abstractions;
using Infrastructure;
using Infrastructure.Context;
using Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using WebAPI.Middleware;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddDbContext<BreaKonfusionContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("BreaKonfusionContext"))
);
builder.Services.AddApplication();
builder.Services.AddApplicationCQRS();
builder.Services.AddProblemDetails();
builder.Services.AddInfrastructure(builder.Configuration);
builder.Services.AddControllers();
builder.Services.AddTodoControllers();
builder.Services.AddSignalR();
// Learn more about configuring Swagger/OpenAPI at
builder.Logging.AddAzureWebAppDiagnostics();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "BreaKonfusion API", Version = "v1" });
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
new string[]{}
}
});
});
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Logging.AddDebug();
builder.Services.AddScoped<ExceptionHandlingMiddleware>();
var app = builder.Build();
app.UseRouting();
// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Breakonfusion API V1");
});
app.UseCors(CorsExtensions.MyAllowSpecificOrigins);
// await app.Services.InitializeDbAsync();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.UseMiddleware<ExceptionHandlingMiddleware>();
app.UseCurrentUser();
app.MapTodoHubs();
app.MapControllers();
app.Run();
My project builds successfully, but on publishing to Azure this error occurs:
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Be sure that the Startup.cs for your application is calling AddSwaggerGen from within ConfigureServices in order to generate swagger file. Visit https://go.microsoft/fwlink/?LinkId=2131205&CLCID=0x409 for more information.
at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.EmitTerminatingError(String bucketName, String displayedErrorMessage, String loggedErrorMessage) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<GenerateSwaggerToBuildOutputDirAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<RunUpdateAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.<RunUpdateWithTelemetryAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.<UpdateApiMApiAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.NewFx.Profiles.BaseSwaggerPublishStep.<RunAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Publish.Framework.Profiles.ProjectProfilesManager.<RunPublishStepsAsync>d__44.MoveNext()
I am using .NET 8 and Visual Studio 2024 and I am registering the Swagger UI in my application.
here is my program.cs file
using Application.Abstractions;
using Infrastructure;
using Infrastructure.Context;
using Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using WebAPI.Middleware;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddDbContext<BreaKonfusionContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("BreaKonfusionContext"))
);
builder.Services.AddApplication();
builder.Services.AddApplicationCQRS();
builder.Services.AddProblemDetails();
builder.Services.AddInfrastructure(builder.Configuration);
builder.Services.AddControllers();
builder.Services.AddTodoControllers();
builder.Services.AddSignalR();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Logging.AddAzureWebAppDiagnostics();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "BreaKonfusion API", Version = "v1" });
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
new string[]{}
}
});
});
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Logging.AddDebug();
builder.Services.AddScoped<ExceptionHandlingMiddleware>();
var app = builder.Build();
app.UseRouting();
// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Breakonfusion API V1");
});
app.UseCors(CorsExtensions.MyAllowSpecificOrigins);
// await app.Services.InitializeDbAsync();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.UseMiddleware<ExceptionHandlingMiddleware>();
app.UseCurrentUser();
app.MapTodoHubs();
app.MapControllers();
app.Run();
Share
Improve this question
edited Nov 21, 2024 at 10:17
Dai
156k30 gold badges305 silver badges424 bronze badges
asked Nov 16, 2024 at 14:56
Awwal15Awwal15
113 bronze badges
8
|
Show 3 more comments
1 Answer
Reset to default 0Please try to upgrade your vscode to latest version. And install Azure Resources
, Azure App Service
extensions.
If you have sign in the azure account, please sign out and sign in again.
If the issue still occurs, we can deploy the project via azure cli. If we can deploy it successfully via command, then we can confirm there is no-permission issue with your account.
Here is the detailed steps.
PS C:\Users\Jason\source\repos\ReactApp4\WebApplication1> dotnet publish -c Release -o ./publish
PS C:\Users\Jason\source\repos\ReactApp4\WebApplication1> Compress-Archive -Path "C:\Users\Jason\source\repos\ReactApp4\WebApplication1\publish\*" -DestinationPath "C:\Users\Jason\source\repos\ReactApp4\WebApplication1\publish.zip"
PS C:\Users\Jason\source\repos\ReactApp4\WebApplication1> az webapp deploy --resource-group jasonp2 --name jasontestwebapp --src-path "C:\Users\Jason\source\repos\ReactApp4\WebApplication1\publish.zip" --type zip
If we can deployed successfully, then we can also deploy this way, not sure if it's caused by extensions.
My project builds successfully, but on publishing to Azure this error occurs:
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Be sure that the Startup.cs for your application is calling AddSwaggerGen from within ConfigureServices in order to generate swagger file. Visit /?LinkId=2131205&CLCID=0x409 for more information.
at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.EmitTerminatingError(String bucketName, String displayedErrorMessage, String loggedErrorMessage) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<GenerateSwaggerToBuildOutputDirAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<RunUpdateAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.<RunUpdateWithTelemetryAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.<UpdateApiMApiAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.NewFx.Profiles.BaseSwaggerPublishStep.<RunAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Publish.Framework.Profiles.ProjectProfilesManager.<RunPublishStepsAsync>d__44.MoveNext()
I am using .NET 8 and Visual Studio 2024 and I am registering the Swagger UI in my application.
here is my program.cs file
using Application.Abstractions;
using Infrastructure;
using Infrastructure.Context;
using Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using WebAPI.Middleware;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddDbContext<BreaKonfusionContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("BreaKonfusionContext"))
);
builder.Services.AddApplication();
builder.Services.AddApplicationCQRS();
builder.Services.AddProblemDetails();
builder.Services.AddInfrastructure(builder.Configuration);
builder.Services.AddControllers();
builder.Services.AddTodoControllers();
builder.Services.AddSignalR();
// Learn more about configuring Swagger/OpenAPI at
builder.Logging.AddAzureWebAppDiagnostics();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "BreaKonfusion API", Version = "v1" });
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
new string[]{}
}
});
});
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Logging.AddDebug();
builder.Services.AddScoped<ExceptionHandlingMiddleware>();
var app = builder.Build();
app.UseRouting();
// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Breakonfusion API V1");
});
app.UseCors(CorsExtensions.MyAllowSpecificOrigins);
// await app.Services.InitializeDbAsync();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.UseMiddleware<ExceptionHandlingMiddleware>();
app.UseCurrentUser();
app.MapTodoHubs();
app.MapControllers();
app.Run();
My project builds successfully, but on publishing to Azure this error occurs:
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Be sure that the Startup.cs for your application is calling AddSwaggerGen from within ConfigureServices in order to generate swagger file. Visit https://go.microsoft/fwlink/?LinkId=2131205&CLCID=0x409 for more information.
at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.EmitTerminatingError(String bucketName, String displayedErrorMessage, String loggedErrorMessage) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<GenerateSwaggerToBuildOutputDirAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.AppServiceApiMApiUpdater.<RunUpdateAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.<RunUpdateWithTelemetryAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.ApiMApi.AppServiceApiMApiPublishHandler.<UpdateApiMApiAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WebTools.Azure.Publish.NewFx.Profiles.BaseSwaggerPublishStep.<RunAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Publish.Framework.Profiles.ProjectProfilesManager.<RunPublishStepsAsync>d__44.MoveNext()
I am using .NET 8 and Visual Studio 2024 and I am registering the Swagger UI in my application.
here is my program.cs file
using Application.Abstractions;
using Infrastructure;
using Infrastructure.Context;
using Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using WebAPI.Middleware;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddDbContext<BreaKonfusionContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("BreaKonfusionContext"))
);
builder.Services.AddApplication();
builder.Services.AddApplicationCQRS();
builder.Services.AddProblemDetails();
builder.Services.AddInfrastructure(builder.Configuration);
builder.Services.AddControllers();
builder.Services.AddTodoControllers();
builder.Services.AddSignalR();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Logging.AddAzureWebAppDiagnostics();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "BreaKonfusion API", Version = "v1" });
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
new string[]{}
}
});
});
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Logging.AddDebug();
builder.Services.AddScoped<ExceptionHandlingMiddleware>();
var app = builder.Build();
app.UseRouting();
// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Breakonfusion API V1");
});
app.UseCors(CorsExtensions.MyAllowSpecificOrigins);
// await app.Services.InitializeDbAsync();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.UseMiddleware<ExceptionHandlingMiddleware>();
app.UseCurrentUser();
app.MapTodoHubs();
app.MapControllers();
app.Run();
Share
Improve this question
edited Nov 21, 2024 at 10:17
Dai
156k30 gold badges305 silver badges424 bronze badges
asked Nov 16, 2024 at 14:56
Awwal15Awwal15
113 bronze badges
8
- The error says you need to do something specific. You didn't show your code. Please provide a minimal reproducible example. – mason Commented Nov 16, 2024 at 15:01
- i have added my program.cs file now – Awwal15 Commented Nov 16, 2024 at 15:04
- How you are deploying your app? – Harshitha Commented Nov 16, 2024 at 15:20
- 1 I am using visual studio code and I’m publishing it to an app service running windows. – Awwal15 Commented Nov 16, 2024 at 16:04
-
@Awwal15 Try to use this code
app.UseSwagger(); app.UseSwaggerUI(x => { x.SwaggerEndpoint("/swagger/v1/swagger.json", "Web API V1"); if(app.Environment.IsDevelopment()) x.RoutePrefix = "swagger"; // For localhost else x.RoutePrefix = string.Empty; // For azure } );
in your program.cs file. – Aslesha Kantamsetti Commented Nov 16, 2024 at 17:13
1 Answer
Reset to default 0Please try to upgrade your vscode to latest version. And install Azure Resources
, Azure App Service
extensions.
If you have sign in the azure account, please sign out and sign in again.
If the issue still occurs, we can deploy the project via azure cli. If we can deploy it successfully via command, then we can confirm there is no-permission issue with your account.
Here is the detailed steps.
PS C:\Users\Jason\source\repos\ReactApp4\WebApplication1> dotnet publish -c Release -o ./publish
PS C:\Users\Jason\source\repos\ReactApp4\WebApplication1> Compress-Archive -Path "C:\Users\Jason\source\repos\ReactApp4\WebApplication1\publish\*" -DestinationPath "C:\Users\Jason\source\repos\ReactApp4\WebApplication1\publish.zip"
PS C:\Users\Jason\source\repos\ReactApp4\WebApplication1> az webapp deploy --resource-group jasonp2 --name jasontestwebapp --src-path "C:\Users\Jason\source\repos\ReactApp4\WebApplication1\publish.zip" --type zip
If we can deployed successfully, then we can also deploy this way, not sure if it's caused by extensions.
本文标签:
版权声明:本文标题:c# - Unable to push my ASP.NET Core 8 Web API to Azure; I am using clean architecture so all my services has been registered - S 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745655904a2161593.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
app.UseSwagger(); app.UseSwaggerUI(x => { x.SwaggerEndpoint("/swagger/v1/swagger.json", "Web API V1"); if(app.Environment.IsDevelopment()) x.RoutePrefix = "swagger"; // For localhost else x.RoutePrefix = string.Empty; // For azure } );
in your program.cs file. – Aslesha Kantamsetti Commented Nov 16, 2024 at 17:13