question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swashbuckle doesnt generate Swagger UI or docs when deployed to Azure App Service

See original GitHub issue

Describe the bug

Swashbuckle doesnt generate Swagger UI or docs when deployed to Azure App Services

To Reproduce

  1. Create an ASP.NET Core Web Application image
  2. Select the “ASP.NET Core Web API” project template image
  3. Debug to make sure Swagger stuff is working image
  4. Publish to Azure image image image
  5. Test to see if api functions image
  6. Test Azure App Service web site to see if Swagger UI / docs are generated image

Further technical details

  • ASP.NET Core version: 5
  • Include the output of dotnet --info .NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829

Runtime Environment: OS Name: Windows OS Version: 10.0.19041 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support): Version: 5.0.0 Commit: cf258a14b7

.NET SDKs installed: 2.2.110 [C:\Program Files\dotnet\sdk] 5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and it’s version
  • Microsoft Visual Studio Enterprise 2019 Version 16.8.2 VisualStudio.16.Release/16.8.2+30717.126 Microsoft .NET Framework Version 4.8.04084

Installed Version: Enterprise

Visual C++ 2019 00435-60000-00000-AA888 Microsoft Visual C++ 2019

ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 2019 16.8.553.28003 ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services 16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2012 16.8.553.28003 For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2019 16.8.553.28003 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.8.553.28003 Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.6.1000.0 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.8.553.28003 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.6.1000.0 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CodeRush for Roslyn 20.2.4.0 DevExpress CodeRush for Roslyn package.

CodeRush for Roslyn Tool Windows 20.2.4.0 DevExpress CodeRush for Roslyn Tool Windows package.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

ConvertToDevExtremeCommand Extension 1.0 ConvertToDevExtremeCommand Visual Studio Extension Detailed Info

Cookiecutter 16.8.20241.2 Provides tools for finding, instantiating and customizing templates in cookiecutter format.

CreateLayoutWizard 1.0 Create layout wizard.

DevExpress Reporting Extension 1.2 A Visual Studio extension that invokes the Report Designer editor for report definition REPX files.

DevExpress Reporting Tools Extension 1.0 Extends Visual Studio with tools required for the Report Designer editor.

DevExpress.DeploymentTool 1.0 A useful tool for deploying DevExpress assemblies.

Extensibility Message Bus 1.2.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events

IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info

JustMock 2020.3.1124.2 Telerik JustMock Extension.

Microsoft Azure HDInsight Azure Node 2.6.1000.0 HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.6.1000.0 Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0 Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.6.1000.0 Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.1.113+g422d40002e.RR Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.8.43 (00471f8) Support for debugging Mono processes with Visual Studio.

Node.js Tools 1.5.20902.1 Commit Hash:b474efcb6f92db52a8f8e2e6a8cb9648476885cc Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 5.8.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Open Command Line 2.4.233 2.4.233

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

Python 16.8.20241.2 Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Conda support 16.8.20241.2 Conda support for Python projects.

Python - Django support 16.8.20241.2 Provides templates and integration for the Django web framework.

Python - IronPython support 16.8.20241.2 Provides templates and integration for IronPython-based projects.

Python - Profiling support 16.8.20241.2 Profiling support for Python projects.

Redgate SQL Prompt 10.4.5.16318 Write, format, and refactor SQL effortlessly

Snapshot Debugging Extension 1.0 Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.62010.06180 Microsoft SQL Server Data Tools

Syntax Visualizer 1.0 An extension for visualizing Roslyn SyntaxTrees.

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 16.0.21016.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions 1.0 View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0 Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Foo 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Xamarin 16.8.000.255 (d16-8@d002176) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.8.0.507 (remotes/origin/d16-8@e87b24884) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.8.112 (86385a3) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 11.1.0.17 (d16-8/c0e2b8e) Xamarin.Android Reference Assemblies and MSBuild support. Mono: be2226b Java.Interop: xamarin/java.interop/d16-8@79d9533 ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000 SQLite: xamarin/sqlite/3.32.1@1a3276b Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

Xamarin.iOS and Xamarin.Mac SDK 14.4.1.3 (e30c41de3) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JasonDWilsoncommented, Jan 4, 2021

you’d be hard-pressed to convince me that we should just turn it on by default and allow security-minded individuals to accidentally describe their APIs or worse, accidentally allow for their test executions. 😃

@bradygaster – couldn’t agree more, just didn’t think to check service registration when I was troubleshooting. Nice work all-in-all. The only downside is I no longer look like a magician when I provide OpenApi docs – you guys have made it way too easy 😉

1reaction
JasonDWilsoncommented, Dec 15, 2020

I completely missed that it was configured to run only if env.IsDevelopment by default. Man don’t I feel foolish – thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger UI not generating in azure .net core but it is ...
Make sure the code isn't in IF conditional (env.IsDevelopment ()). This the reason why only work on localhost. This avoids working in production ......
Read more >
Microsoft Azure + Swagger: The Step by Step Guide
First, open your Azure Mobile App project using Visual Studio. ... Right click on the project and select “Manage NuGet Packages”. ... Search...
Read more >
Configuring and Using Swagger UI in ASP.NET Core Web ...
Integrating Swagger UI into our Applications. We can use the Swashbuckle package to easily integrate Swagger into our .NET Core Web API projects ......
Read more >
Get started with Swashbuckle and ASP.NET Core
Swashbuckle.AspNetCore.SwaggerGen: a Swagger generator that builds SwaggerDocument objects directly from your routes, controllers, and models.
Read more >
Swagger UI page is blank on localhost IISExpress SSL URL
I am developing a v5.0.6 ASP.NET Core WebApi and included Swashbuckle.AspNetCore Swagger with SwaggerUI enabled. I am developing with Visual ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found