【发布时间】: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