Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to download an exe file #24

Closed
ltemimi opened this issue Jan 22, 2021 · 13 comments
Closed

Unable to download an exe file #24

ltemimi opened this issue Jan 22, 2021 · 13 comments
Assignees
Labels
good first issue Good for newcomers question Further information is requested

Comments

@ltemimi
Copy link

ltemimi commented Jan 22, 2021

Hi

I am unable to download an exe file I get "error reload the page" yet I am able to download exe files from websites so I do not think it is a system or browser settings issue.

I am able to download msi files .

Thanks

Laz

@arivera12
Copy link
Owner

arivera12 commented Jan 22, 2021

How do you are downloading the file? As a stream or byte[]?

@arivera12 arivera12 self-assigned this Jan 22, 2021
@arivera12 arivera12 added good first issue Good for newcomers question Further information is requested labels Jan 22, 2021
@ltemimi
Copy link
Author

ltemimi commented Jan 22, 2021

yes as a stream of bytes

var bytes = FileHelper.GetFileBytes(filePatch); var result = await BlazorDownloadFileService.DownloadFile(fileToDownload, bytes, "application/octet-stream");

@arivera12
Copy link
Owner

arivera12 commented Jan 22, 2021

can you share any screenshot of the error? How big is the file?

@ltemimi
Copy link
Author

ltemimi commented Jan 22, 2021

EXEDownload

all other files (bigger) download OK issue just with exe file

@arivera12
Copy link
Owner

arivera12 commented Jan 22, 2021

This error seems or may be related to this one #25

@arivera12
Copy link
Owner

Pretty weird the other bigger files downloads ok but not the exe file...

@ltemimi
Copy link
Author

ltemimi commented Jan 28, 2021

Hi

I increased the buffer size and I am now able to download my 110MB exe file but it takes 2 minutes for the download dialog to appear. I am using Blazor server app.

Is there a way of speeding the download up?

Thanks

@arivera12
Copy link
Owner

arivera12 commented Jan 28, 2021

Thats something I forgot to ask about...

If it's blazor wasm or blazor server.

Blazor server transmit data using signal r and there are limitations on this.

I left those notations in the main readme.md of this repository

Take a look of this where I do left written some performance considerations and understandings.

https://github.com/arivera12/BlazorDownloadFile#performance-considerations-and-understandings

The next link is the signal r documentation and based on this you need to do buffer management based on your signal r ApplicationMaxBufferSize and TransportMaxBufferSize

ApplicationMaxBufferSize is the incoming connection buffer size

TransportMaxBufferSize is the outgoing connection buffer size (This is the one you need to increase download speed)

https://docs.microsoft.com/en-us/aspnet/core/signalr/security?view=aspnetcore-3.1#buffer-management

Based on this you need to download your file using the overload methods which manages the download buffer internally.

public async ValueTask<DowloadFileResult> DownloadFile(string fileName, byte[] bytes, int bufferSize = 32768, string contentType = "application/octet-stream", IProgress<double>? progress = null)

@arivera12
Copy link
Owner

arivera12 commented Jan 28, 2021

Hi

I increased the buffer size and I am now able to download my 110MB exe file but it takes 2 minutes for the download dialog to appear. I am using Blazor server app.

Is there a way of speeding the download up?

Thanks

Answering your question:

You can speed up download by increasing the buffer size.

@arivera12
Copy link
Owner

arivera12 commented Jan 28, 2021

I increased the buffer size and I am now able to download my 110MB exe file but it takes 2 minutes for the download dialog to appear. I am using Blazor server app.

How much did you increased the buffer size and where did you increase it?

Blazor server app?

Or on blazor download file method?

Both sides?

@ltemimi
Copy link
Author

ltemimi commented Jan 29, 2021

 endpoints.MapBlazorHub(o =>
                {
                    o.TransportMaxBufferSize = 1024*128;
                    o.ApplicationMaxBufferSize = 1024*128;
                });

 var result =  await BlazorDownloadFileService.DownloadFile(fileToDownload, bytes, 1024*64);

The signal R buffer increase do not make any difference to the loading of the file from the server to be downloaded by the client

I am grateful for the help

@arivera12
Copy link
Owner

arivera12 commented Jan 29, 2021

 endpoints.MapBlazorHub(o =>
                {
                    o.TransportMaxBufferSize = 1024*128;
                    o.ApplicationMaxBufferSize = 1024*128;
                });

 var result =  await BlazorDownloadFileService.DownloadFile(fileToDownload, bytes, 1024*64);

The signal R buffer increase do not make any difference to the loading of the file from the server to be downloaded by the client

I am grateful for the help

The only way to speed up download speed is to increase the buffer size here

BlazorDownloadFileService.DownloadFile(fileToDownload, bytes, 1024*64);

Bigger the buffer size, bigger are the chunks that are send from the server to the client.

Take note that your internet service provider speed is also a variant on your download speed.

As far I know there is nothing else we can do to speed up download rather than just increasing the download buffer size.

@arivera12
Copy link
Owner

Since this question was asked only for downloading exe file and you asked me about download speed I created a new issue for that. Please refer to this issue since downloading the exe file was already resolved for you. #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants