Swashbuckle.WebApi
Swashbuckle.WebApi copied to clipboard
Base URL is not populating in Swashbuckle 5.0
The Base URL is not showing even after setting up c.RootUrl(req => GetRootUrlFromAppConfig());
Could you please advise ?
I have the same problem even without changing the c.RootUrl(). The application is running from the root of the website.
Can you elaborate or maybe provide a screenshot? @dstarosta if you're app is running from the root of the website, then there is no base URL
Closing due to inactivity. Please go ahead and re-open if you can provide some more information
Still in 5.2.2
config.EnableSwagger("api-docs/{apiVersion}/swagger", c =>
{
c.RootUrl(req => ApiConfig.GetRootUrl());
c.Schemes(new[] { "http" });
c.BasicAuth("Basic");
c.SingleApiVersion(ApiConfig.GetCurrentVersion(), "Gateway REST API documentation")
.Description("Active documentation of Gateway system API");
c.IncludeXmlComments(ApiConfig.GetXmlCommentsPath());
}).EnableSwaggerUi(
ApiConfig.GetApiDocumentationUrl() + "/{*assetPath}"
);
Regards
I have the same problem, any ideas?
Same problem here.
Same problem in 5.3.2
Seeing the same behavior.
In the example above -
http://localhost:9000/api-docs/v1/swagger
Is the application actually hosted in an IIS Virtual Directory (or self-hosted equivalent) called "api-docs" ? The "BASE URL" that shows up on Swagger is mapped to the "basePath" property of the swagger document, which in turn is set up like this:
var swaggerDoc = new SwaggerDocument
{
...
basePath = (rootUri.AbsolutePath != "/") ? rootUri.AbsolutePath : null,
...
};
If it isn't hosted in a Virtual Directory that resides within the application root, then that AbsolutePath property is going to be null - hence the Base URL that you see is also going to be empty. Might be worth taking a look at..
EDIT: typo.
Still seeing this in 5.4.0, my application is hosted in IIS
I have this in my EnableSwagger section of SwaggerConfig
c.RootUrl(j=> System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/MyApi") .AppSettings.Settings["baseUrl"].Value);
Hello :) Same problem in 5.4.0
@domaindrivendev Can I ping you to take a look at this? This thing was pre-installed with a Visual Studio template. I hit F5 and I see a blank URL on IIS. Same thing when published to Azure. It looks like the screenshot posted by @Krikroff77.
I also am encountering this issue.
Workaround CSS?
div.footer { display:none; }
@domaindrivendev Same issue here, running from an Owin server in a desktop application.
Has this been resolved yet? I am having same issue, ideally it should be version specific so it shows different urls when selecting different version.
Not for me . :-(
Also having this same issue.
My RootUrl is working as expected, however the URL shown in the "Curl" and "Request URL" areas does not contain the base.
If I add: using System.Net.Http; in top of Swaggerconfig.cs and replace: c.RootUrl(req => GetRootUrlFromAppConfig()); with: c.RootUrl(req => req.RequestUri.GetLeftPart(UriPartial.Authority).TrimEnd('/') + req.GetRequestContext().VirtualPathRoot.TrimStart('/')); it works with Swashbuckle v.5.6.0.
Having the same issue on v5.6.0. My application is hosted in IIS.
I'm having the same issue. Swashbuckle v5.6.0. App is hosted in IIS. Nothing too fancy.
Specifying c.RootUrl(req => GetRootUrlFromAppConfig()); has no effect.
app.UseSwagger(c =>
{
c.PreSerializeFilters.Add((swaggerDoc, httpReq) => {
swaggerDoc.Host = httpReq.Host.Value;
swaggerDoc.Schemes = new List
If any one using Dot Net Core