浏览代码

解决blob播放视频无法支持Accept-Ranges: bytes 的问题

CrazyIter_Bin 3 年之前
父节点
当前提交
cce9c47a6d
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      TEAMModelOS/Startup.cs

+ 6 - 1
TEAMModelOS/Startup.cs

@@ -7,6 +7,7 @@ using System.Text;
 using System.Text.Json;
 using System.Text.Json;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using Azure.Storage.Blobs.Models;
 using HTEXLib.Builders;
 using HTEXLib.Builders;
 using HTEXLib.Translator;
 using HTEXLib.Translator;
 using Lib.AspNetCore.ServerSentEvents;
 using Lib.AspNetCore.ServerSentEvents;
@@ -145,12 +146,16 @@ namespace TEAMModelOS
         }
         }
 
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
-        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AzureStorageFactory _azureStorage)
         {
         {
             if (env.IsDevelopment())
             if (env.IsDevelopment())
             {
             {
                 app.UseDeveloperExceptionPage();
                 app.UseDeveloperExceptionPage();
             }
             }
+            //解决blob播放视频无法支持Accept-Ranges:  bytes 的问题
+            BlobServiceProperties prop = _azureStorage.GetBlobServiceClient().GetProperties();
+            prop.DefaultServiceVersion = "2018-03-28";
+            _azureStorage.GetBlobServiceClient().SetProperties(prop);
             //TODO 目前不使用中間件全局攔截Exception,請在API中,明確處理200成功返回值或錯誤碼,Exception一率返回BadRequert 400,並選擇需要返回釘釘群組回報的API
             //TODO 目前不使用中間件全局攔截Exception,請在API中,明確處理200成功返回值或錯誤碼,Exception一率返回BadRequert 400,並選擇需要返回釘釘群組回報的API
             //app.UseMiddleware<HttpGlobalExceptionInvoke>();
             //app.UseMiddleware<HttpGlobalExceptionInvoke>();