我已经按照一些教程进行了工作,但由于某种原因,我无法显示UI,但是创建了Swagger Json.我看过的最后一个教程就在这里.
我的设置是这样的:
Nuget套餐: Swashbuckle.AspNetCore(1.0.0)
ConfigureServices 方法:
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1",
new Info
{
Title = "MediatR Example",
Version = "v1",
Description = "Trying out the MediatR library to simplify Request and Response logic.",
TermsOfService = "WTFPL",
Contact = new Contact
{
Email = "",
Name = "",
Url = "https://github.com/CubicleJockey/MediatR-Playground"
}
}
);
var xmlDocFile = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, @"MediatR-Messages.Api.xml");
options.IncludeXmlComments(xmlDocFile);
options.DescribeAllEnumsAsStrings();
});
Run Code Online (Sandbox Code Playgroud)
Configure 方法:
app.UseMvcWithDefaultRoute();
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// …Run Code Online (Sandbox Code Playgroud) swagger swagger-ui swagger-2.0 asp.net-core-webapi .net-core-2.0