There was a problem loading the comments.

Lets Encrypt giving 404 on .net application

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
This article is for people running .net core that are unable to issue a let's encrypt SSL.

If Lets Encrypt is not issuing an SSL to your .net core site, then the next step is to check the folders have been created.

In the websites root directory, you should check the .well-known directory has been created, which should contain another folder called pki-validation.

Within the validation folder, should be some text files. If you get one of the names of the files, you can then try browsing to it, for example:

http://mydomain.com/.well-known/acme-challenge/C9bmjmIk3dhgeWpuSORjOqkZPmcCpQVTVi6ob0BvObc

If you get a 404, then the .net core application is handling the request. You can set your ASP.NET Core website to send the file located in the directory .well-known. This is possible by registering it:


public class Startup

{
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseStaticFiles(); // wwwroot
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @".well-known")),
RequestPath = new PathString("/.well-known"),
ServeUnknownFileTypes = true // serve extensionless file
});

app.UseMvc();
}
}

Share via

Related Articles

© Hosting UK