我正在尝试将SSL集成到我的asp.net核心项目中,我下载sslforfree文件进行manuel验证。我将验证文件上传到我的服务器
虽然路径中的服务器中有文件,但在浏览器中浏览我的网站时会出现错误
找不到此页面没有找到网址的网页:
这是链接。
我的.net核心网站工作。它只显示验证文件
这是我的服务器路径文件
在IIS服务器中,我给mime类型。(逗号)作为text / plain但它仍然给出错误。我该怎么办?这适用于带有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 Type =“text / plain”。当您单击网站根目录时,可以在IIS管理器中找到它。也许它不适合你,因为你输入逗号而不是句号。
您可以通过在您的网站中放置文本文件但没有文件扩展名来测试它的工作原理。如果您显示文件内容,则设置正常,sslforfree将能够验证您的域。
仅供参考我在Windows 10版本1809上使用IIS 10。