2017-12-18 279 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 
});