Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Swashbuckle - Swagger Docs #1802

Unanswered
abentley-technolog-ltd asked this question in Q&A
Discussion options

Hi,

Does anybody know how to get Swashbuckle.AspNetCore working?

I set my ASPNETCORE_ENVIRONMENT to development, but I keep getting a 404 back from the server when I go to the swagger page.

	/// <summary>
	/// Configure the HTTP request pipeline
	/// </summary>
	/// <param name="app">The app builder</param>
	/// <param name="env">The host environment</param>
	public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
	{
		Log.Logger.Information("Configuring");
 Console.WriteLine("Configuring");
		if (env.IsDevelopment())
		{
			Log.Logger.Warning("Loading Swagger...");
			Console.WriteLine("Loading Swagger");
			app.UseDeveloperExceptionPage();
			app.UseSwagger();
			app.UseSwaggerUI();
		}
		app.UseExceptionHandler("/error");
		app.UseHttpsRedirection();
		app.UseAuthentication();
		app.UseRouting();
		app.UseAuthorization();
		app.UseEndpoints(endpoints =>
		{
			endpoints.MapControllers();
		});
	}

[10:44:03 INF] Request starting null GET {url}/swagger/index.html - null 0
[10:44:03 INF] Request finished null GET {url}/swagger/index.html - 404 null null 87.1275ms
[10:44:03 INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: GET {url}/swagger/index.html, Response status code: 404

You must be logged in to vote

Replies: 1 comment

Comment options

Hello @abentley-technolog-ltd,

How are you setting ASPNETCORE_ENVIRONMENT? Can you confirm if there is no conflicting settings for the environment variable?

Please shed some light on how you are creating this application? Are you using any dotnet CLI template? For example if I use a serverless.AspNetCoreWebApp template, ASPNETCORE_ENVIRONMENT is set to Development by default inside launchSettings.json.

Regards,
Chaitanya

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /