2017-12-18 437 views
0

我正在尝试将SSL集成到我的asp.net核心项目中 我下载了sslforfree文件进行manuel验证。我上传验证文件到我的服务器.Net Core SSL文件此页面无法找到没有找到网页的网址:

虽然有文件服务器的路径它在浏览器中浏览自己的网站时

该页面无法找到未在此网址找到网页地址给该错误:

这里是链接。

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

这里是我的服务器路径文件

enter image description here

在IIS服务器,我给MIME类型 。(逗号)作为text/plain 但它仍然给错误。我该怎么办?这是.net mvc项目与4.0应用程序池的工作,但给页面找不到错误与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?}"); 
      }); 
     } 
    } 
+0

你的管道在Startup.Configure中看起来像什么? –

+0

@IvanZaruba感谢answear.I添加了startup.cs结束的问题,我应该添加任何命令路径访问? – user1688401

回答

2

默认情况下StaticFilesMiddleware预计请求将有一个扩展,将是一个已知类型的文件。你没有扩展,所以你可以添加一个自定义的中间件来提供这些文件或配置默认的中间件

app.UseStaticFiles(new StaticFileOptions 
{ 
    ServeUnknownFileTypes = true 
});