【问题标题】:HTTPS redirect using Azure Storage Emulator使用 Azure 存储模拟器的 HTTPS 重定向
【发布时间】:2020-05-20 13:19:11
【问题描述】:

我正在开发一个用 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}"); });
}

不管怎样,在那之后什么都没有改变。任何人都知道为什么即使我使用的是DefaultEndpointsProtocol=http,我也有一个 https 重定向?

【问题讨论】:

    标签: c# asp.net azure https azure-storage-emulator


    【解决方案1】:

    存储模拟器仅支持通过 HTTP 连接。但是,HTTPS 是用于访问生产 Azure 存储帐户中的资源的推荐协议。

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-10
      • 1970-01-01
      • 2017-09-25
      • 1970-01-01
      • 1970-01-01
      • 2014-07-03
      相关资源
      最近更新 更多