Ssl .netcore应用程序wwwroot外部的静态文件

Ssl .netcore应用程序wwwroot外部的静态文件,ssl,iis,asp.net-core,static-files,staticfilehandler,Ssl,Iis,Asp.net Core,Static Files,Staticfilehandler,我在@home web服务器上使用SSL(它是免费的!:O)。这是一本相当手动的手册,但在wiki上注意到它提到了另一个项目,其中有一个GUI,用于自动申请、下载SSL证书并将其安装到web服务器 GUI用于验证域的方法是您自己的,它是通过在[webroot]/.well/[randomFile]中创建一个随机命名的文件,其中包含一个随机文本字符串,并且没有扩展名。由于.dotnetcore应用程序在此[webroot]上运行,我无法为该文件提供服务,即使在遵循IIS下更改“处理程序映射”的说明

我在@home web服务器上使用SSL(它是免费的!:O)。这是一本相当手动的手册,但在wiki上注意到它提到了另一个项目,其中有一个GUI,用于自动申请、下载SSL证书并将其安装到web服务器

GUI用于验证域的方法是您自己的,它是通过在
[webroot]/.well/[randomFile]
中创建一个随机命名的文件,其中包含一个随机文本字符串,并且没有扩展名。由于.dotnetcore应用程序在此[webroot]上运行,我无法为该文件提供服务,即使在遵循IIS下更改“处理程序映射”的说明之后也是如此

似乎我可以通过在
[webRoot]/wwwroot/[whatever]
中直接导航到文件来提供服务-那么为什么我不能在
[webRoot]/.well/[randomFile]
中提供服务呢


有人知道这件事吗?我可以删除.netcore应用程序,然后运行SSL证书安装,但此安装需要每2-3个月进行一次,因为它是手动的,所以我希望找出正确的方法。

我在这里找到了我需要的信息:

基本上,以我的身份,我需要改变这一点:

        // allows for the direct browsing of files within the wwwroot folder
        app.UseStaticFiles();

        // MVC routes
        app.UseMvc(routes => 
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });
为此:

        // allows for the direct browsing of files within the wwwroot folder
        app.UseStaticFiles();

        // Allow static files within the .well-known directory to allow for automatic SSL renewal
        app.UseStaticFiles(new StaticFileOptions()
        {
            ServeUnknownFileTypes = true, // this was needed as IIS would not serve extensionless URLs from the directory without it
            FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @".well-known")),
            RequestPath = new PathString("/.well-known")
        });

        // MVC routes
        app.UseMvc(routes => 
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });
编辑- 请注意,此目录“.well-known”仅在web服务器上创建,当我在本地重新开始开发时,由于“.well-known”目录不存在,所以出现了错误。所以现在我的项目中只有一个空目录,但至少我的SSL更新是自动的!:D