0

I am trying to integrate SSL to my asp.net core project I download sslforfree file for manuel verification.I upload verify file to my server

although there is file in server in path it give that error when browsing my website in browser

This page can’t be found No webpage was found for the web address:

here is link.

my .net core website work.Just it does not show verify files

here is my server path file

enter image description here

In IIS server I give mime types .(comma) as text/plain but it still give error.What should I do?This is work for .net mvc project with 4.0 application pool but give page not found error with asp.net core application pool

here is my 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?}");
            });
        }
    }
user1688401
  • 1,851
  • 8
  • 47
  • 83

2 Answers2

3

By default StaticFilesMiddleware expects the file requested will have an extension and will be of a known type. You have no extensions, so you could either add a custom middleware that will serve those files or configure the default middleware with

app.UseStaticFiles(new StaticFileOptions
{
    ServeUnknownFileTypes = true
});
Ivan Zaruba
  • 4,236
  • 5
  • 20
  • 29
1

For clarification, your question is a little confusing by referencing a period as a comma.

I had this same problem because by default IIS does not display file contents of files without file extensions. I was also trying to verify my domain by manual method on sslforfree.com.

The solution that worked for me was, as you mentioned to add entry Extension = "." (period); MIME Type = "text/plain" in IIS MIME Types for my website. This can be found in IIS Manager when you click on your website root. Perhaps it didn't work for you because you put in a comma instead of a period.

You can test it works by placing a text file in your website but without the file extension. If you get the file contents displayed, then the setting is working correctly, and sslforfree will be able to verify your domain.

FYI I'm using IIS 10 on Windows 10 version 1809.

Karlossus
  • 83
  • 7