Skip to content

Commit 1be7ee1

Browse files
author
Dominik Oswald
committed
Add Kestrel config to appsettings.json
Set RouteTemplate for swagger (domaindrivendev/Swashbuckle.WebApi#1135)
1 parent 900fe83 commit 1be7ee1

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup/Program.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@ public static void Main(string[] args)
1414

1515
public static IWebHost BuildWebHost(string[] args)
1616
{
17-
var config = new ConfigurationBuilder()
18-
.SetBasePath(Directory.GetCurrentDirectory())
19-
.AddJsonFile("appsettings.json", optional: false)
20-
.Build();
21-
2217
return WebHost.CreateDefaultBuilder(args)
2318
.UseStartup<Startup>()
24-
.UseUrls(config.GetValue<string>("App:ServerRootAddress"))
2519
.Build();
2620
}
2721
}

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup/Startup.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
138138
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
139139
endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
140140
});
141-
141+
142142
// Enable middleware to serve generated Swagger as a JSON endpoint
143-
app.UseSwagger();
143+
app.UseSwagger(c => { c.RouteTemplate = "swagger/{documentName}/swagger.json"; });
144+
144145
// Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
145146
app.UseSwaggerUI(options =>
146147
{

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/appsettings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,12 @@
1414
"Issuer": "AbpProjectName",
1515
"Audience": "AbpProjectName"
1616
}
17+
},
18+
"Kestrel": {
19+
"Endpoints": {
20+
"Http": {
21+
"Url": "http://localhost:21021/"
22+
}
23+
}
1724
}
1825
}

0 commit comments

Comments
 (0)