Search code examples
c#asp.netazurehttpsazure-storage-emulator

HTTPS redirect using Azure Storage Emulator


I'm working on a local ASP.NET web application written in C# and hosted using IIS Express.

I want to store a blob using Azure Storage Emulator with the default configuration. This is my Connection String:

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;

When I ran my local web-app and I tried to store a blob, I got this error in 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

Since the url in this error has the https protocol, I commented the UseHttpsRedirection policy in Startup.cs:

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}"); });
}

Anyway, nothing changed after that. Anyone know why I have an https redirect even if I'm using DefaultEndpointsProtocol=http?


Solution

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

    Now, often this error disappears itself when you refresh the page, but sometimes it comes again and again. If you are experiencing such kind of warnings, here we’re explaining various solutions to fix ERR_SSL_PROTOCOL_ERROR or you could change other browser to try again.

    1.Check the Date of Your System
    2. Clear Browsing Data
    3. Clear Your SSL State
    4. Disable QUIC Protocol of Chrome
    5. Check Your Antivirus Settings
    6. Check Your Firewall
    7. Disable Extensions
    8. Adjust Your Internet Security and Privacy Level