filipw / Strathweb.AspNetCore.AzureBlobFileProvider

MIT License
55 stars 22 forks source link

Sample code does not work for .NET Core 3.0 #20

Closed pkenterlis closed 3 years ago

pkenterlis commented 4 years ago

Hello,

I want to use the library in a .NET Core 3.0 application. However, when i try to access the blob, i get the following error.

System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'D:\Strathweb.AspNetCore.AzureBlobFileProvider-master\src\SampleWeb\https:\my-acccount.blob.core.windows.net\site-media\1\f027a2f1-7fe2-451b-a816-08efdf9f5798.jpg' at System.IO.FileSystemInfo.EnsureDataInitialized() at System.IO.FileInfo.get_Length() at Microsoft.AspNetCore.Http.SendFileFallback.SendFileAsync(Stream destination, String filePath, Int64 offset, Nullable`1 count, CancellationToken cancellationToken) at Microsoft.AspNetCore.StaticFiles.StaticFileContext.SendAsync() at Microsoft.AspNetCore.StaticFiles.StaticFileContext.ServeStaticFile(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Is there some setting that i may be missing?

marlind89 commented 4 years ago

I have the same problem!

It seems to be an issue related with netcore 3.x. I have had this working with my application in .NET Core 2.2, but now when I try to upgrade my application to .NET Core 3.1 I get the same issue as you described.

I am however not sure if its a bug in this library or in NET Core 3.x.

kdcllc commented 4 years ago

@filipw It seems that new 3.1.1 Static Middleware implements a new logic: https://github.com/dotnet/aspnetcore/blob/ebb2656e3ea4dd5199fb63925c6e14e99e432399/src/Middleware/StaticFiles/src/StaticFileContext.cs#L348 thus the following line should be removed https://github.com/filipw/Strathweb.AspNetCore.AzureBlobFileProvider/blob/27a2bd0ac2a84c1ac4964b3f6d57504a5c060f7f/src/Strathweb.AspNetCore.AzureBlobFileProvider/AzureBlobFileInfo.cs#L31

Thoughts?

ibruynin commented 3 years ago

@filipw It seems that new 3.1.1 Static Middleware implements a new logic: https://github.com/dotnet/aspnetcore/blob/ebb2656e3ea4dd5199fb63925c6e14e99e432399/src/Middleware/StaticFiles/src/StaticFileContext.cs#L348 thus the following line should be removed

https://github.com/filipw/Strathweb.AspNetCore.AzureBlobFileProvider/blob/27a2bd0ac2a84c1ac4964b3f6d57504a5c060f7f/src/Strathweb.AspNetCore.AzureBlobFileProvider/AzureBlobFileInfo.cs#L31

Thoughts?

I confirm that that works here as well