Browse Source

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

CrazyIter_Bin 3 years ago
parent
commit
cce9c47a6d
1 changed files with 6 additions and 1 deletions
  1. 6 1
      TEAMModelOS/Startup.cs

+ 6 - 1
TEAMModelOS/Startup.cs

@@ -7,6 +7,7 @@ using System.Text;
 using System.Text.Json;
 using System.Threading;
 using System.Threading.Tasks;
+using Azure.Storage.Blobs.Models;
 using HTEXLib.Builders;
 using HTEXLib.Translator;
 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.
-        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AzureStorageFactory _azureStorage)
         {
             if (env.IsDevelopment())
             {
                 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
             //app.UseMiddleware<HttpGlobalExceptionInvoke>();