使用 Azure 存储模拟器的 HTTPS 重定向

HTTPS redirect using Azure Storage Emulator

我正在开发一个用 C# 编写并使用 IIS Express 托管的本地 ASP.NET Web 应用程序。

我想使用默认配置的 Azure 存储模拟器存储 blob。这是我的连接字符串:

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;

当我 运行 我的本地网络应用程序和我试图存储一个 blob 时,我在 Chrome 中遇到了这个错误:

PUT https://127.0.0.1:10000/devstoreaccount1/test1/0001_44f8f0366bcd492596c2d0ca76ae4329?sv=2018-03-28&sr=c&sig=XvGrFIEJzVi259336q56WKRMlJOJ8yYtq7QzaA%2FqByM%3D&se=2020-02-04T17%3A44%3A07Z&sp=w&api-version=2018-03-28 net::ERR_SSL_PROTOCOL_ERROR

由于这个错误中的url有https协议,我在Startup.cs中评论了UseHttpsRedirection策略:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
  ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
  configurationBuilder.SetBasePath(env.ContentRootPath);
  configurationBuilder.AddJsonFile("appsettings.json", false, true);

  if (env.IsDevelopment())
  {
    app.UseDeveloperExceptionPage();
    configurationBuilder.AddUserSecrets<Startup>();
  }
  else
  {
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
  }

  //app.UseHttpsRedirection();
  app.UseStaticFiles();
  app.UseCookiePolicy();

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

无论如何,在那之后什么都没有改变。任何人都知道为什么我有一个 https 重定向,即使我使用 DefaultEndpointsProtocol=http?

The storage emulator supports connection via HTTP only. However, HTTPS is the recommended protocol for accessing resources in a production Azure storage account.

现在,当您刷新页面时,这个错误通常会自行消失,但有时它会一次又一次地出现。如果您遇到此类警告,我们在此说明各种 solutions 以修复 ERR_SSL_PROTOCOL_ERROR 或者您可以更换其他浏览器重试。

1.Check 您的系统日期
2. 清除浏览数据
3. 清除您的 SSL 状态
4.禁用Chrome
的QUIC协议 5. 检查您的防病毒设置
6. 检查你的防火墙
7. 禁用扩展
8. 调整您的互联网安全和隐私级别