Forum Discussion

MZ2019's avatar
Occasional Visitor
6 years ago

Calling Swagger UI causes ASP.NET Core 2.2 HTTPS API Schannel exception

I have an Windows ASP.NET API configured with SwaggerDoc, SwagerUI and SwaggerGen:


public void ConfigureServices(IServiceCollection services)
    services.AddSwaggerGen(setup =>
        setup.SwaggerDoc(SwaggerDocVersion, new Info { Title = SwaggerDocTitle, Version = SwaggerDocVersion });
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseSwagger(); app.UseSwaggerUI(setup => { setup.SwaggerEndpoint($"/swagger/{SwaggerDocVersion}/swagger.json", SwaggerDocTitle); }); ...


The API is secured with an X.509 certificate with an invalid name (Chrome reports "ERR_CERT_COMMON_NAME_INVALID").


Navigating to /swagger causes the Chrome warning for "invalid name," as expected, and if I do not continue, the Swagger UI does not display and the API remains up.


However, if I continue to the site, that causes the Swagger UI to display but the API reports an Schannel error and becomes unresponsive.


The entry in Windows Event Log is: Event: 36887, Source: Schannel, Message: The following fatal alert was received: 46.


I don't know if this is a Chrome, Swagger or ASP.NET issue... can anyone point me in the right direction to look?


Also, if I'm asking in the wromng forum, please direct me to the correct one.


Thank you.


No RepliesBe the first to reply