.Net Core SSL 文件 This page can't found 没有找到该网址的网页:

.Net Core SSL file This page can’t be found No webpage was found for the web address:

我正在尝试将 SSL 集成到我的 asp.net 核心项目中 我为 manuel 下载 sslforfree 文件 verification.I 上传验证文件到我的服务器

虽然路径中的服务器中有文件,但在浏览器中浏览我的网站时出现该错误

无法找到该网页未找到该网址的网页:

这里是link。

我的 .net 核心网站 work.Just 它不显示验证文件

这是我的服务器路径文件

在 IIS 服务器中,我提供 mime 类型 .(逗号)作为 text/plain 但它仍然给出 error.What 我应该怎么做?这适用于具有 4.0 应用程序池的 .net mvc 项目,但使用 asp.net 核心应用程序池

给出页面未找到错误

这是我的 startup.cs

 public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddSession();


        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseSession();

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

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default2",
                    template: "{controller=Admin}/{action=BookFastSearch}/{id?}");
            });
        }
    }

默认情况下 StaticFilesMiddleware 期望请求的文件具有扩展名并且属于已知类型。您没有扩展,因此您可以添加一个自定义中间件来为这些文件提供服务,或者使用

配置默认中间件
app.UseStaticFiles(new StaticFileOptions
{
    ServeUnknownFileTypes = true
});

为了澄清起见,您的问题将句号引用为逗号,有点令人困惑。

我遇到了同样的问题,因为默认情况下 IIS 不显示没有文件扩展名的文件的文件内容。我还在 sslforfree.com.

上尝试通过手动方法验证我的域

正如您提到的,对我有用的解决方案是添加条目 Extension = "." (时期);我网站的 IIS MIME 类型中的 MIME 类型 = "text/plain"。当您单击您的网站根目录时,可以在 IIS 管理器中找到它。也许它对你不起作用,因为你输入了逗号而不是句号。

您可以通过在您的网站中放置一个文本文件但不带文件扩展名来测试它是否有效。如果显示文件内容,则说明设置正常,sslforfree 将能够验证您的域。

仅供参考,我在 Windows 10 版本 1809 上使用 IIS 10。