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

Error while downloading large size file over IIS Blazor Server #5

Closed
merajsyed opened this issue Jun 8, 2020 · 18 comments
Closed

Error while downloading large size file over IIS Blazor Server #5

merajsyed opened this issue Jun 8, 2020 · 18 comments
Assignees
Labels
blazor server This is related to blazor server side bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@merajsyed
Copy link

Getting following error while downloading large size file (around 30 MB) after publishing to IIS

Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ().'.

Blazor_Large_Download_Error

@arivera12 arivera12 self-assigned this Jun 8, 2020
@arivera12 arivera12 added the good first issue Good for newcomers label Jun 8, 2020
@arivera12
Copy link
Owner

arivera12 commented Jun 8, 2020

@merajsyed it's seems you are getting a timeout from SignalR.

This is by security design, SignalR max message size by default its only 32 KB.

Take a look of SignalR Security.

To fix this issues you have options like:

Increase SignalR ApplicationMaxBufferSize (Not recommended)

Download the file from using HttpClient then pass the data received data to BlazorDownloadFile (This should be the way to go)

@arivera12 arivera12 changed the title Error while downloading large size file over IIS Error while downloading large size file over IIS Blazor Server Jun 8, 2020
@merajsyed
Copy link
Author

Same error after increasing ApplicationMaxBufferSize.

I tried by increasing MaximumReceiveMessageSize also but no luck.
services.AddSignalR(e => { e.MaximumReceiveMessageSize = 102400000; });

@arivera12
Copy link
Owner

Can you attach a sample which reproduces this error?

@arivera12
Copy link
Owner

arivera12 commented Jun 9, 2020

Did you increased or tried TransportMaxBufferSize as well?

@merajsyed
Copy link
Author

Yes, I tried by increasing TransportMaxBufferSize as well.
I cannot share the sample file due to sensitive data. It is working fine locally. Error is coming only after publishing to IIS.

@arivera12
Copy link
Owner

I haven't try the library over iis and over blazor server so I don't know how and if this works over them, only blazor wasm.

But you have confirmed that it works over blazor server, that it's good.

I haven't try run blazor over iis so I don't know what could be wrong.

Are you deploying to iis over azure or local iis?

@arivera12
Copy link
Owner

@arivera12
Copy link
Owner

The only way to fix this may be comparing you iis express setting vs your iis settings in production envinroment.

@merajsyed merajsyed reopened this Jun 10, 2020
@merajsyed
Copy link
Author

merajsyed commented Jun 10, 2020

Accidentally closed the issue.
I am deploying it over local iis and have web socket enabled.
It seems other people also have same issue reported with aspnetcore dotnet/aspnetcore#21546

@arivera12
Copy link
Owner

The link shared redirects to this repository.

@arivera12
Copy link
Owner

I copy the text instead.

@arivera12
Copy link
Owner

arivera12 commented Jun 10, 2020

I read the issue, its seems a problem with blazor server with deployment host, related. Have you tried or have a chance to deploy this on top of blazor wasm? If not possible, I just ran out of ideas, we would need to wait for a fix.

@merajsyed
Copy link
Author

merajsyed commented Jun 10, 2020

I ended up downloading in chunks as used in this gist and it worked.

@arivera12
Copy link
Owner

@merajsyed so It's seems I may have a bug with max capacity of downloading a file... I will keep this issue open to upgrade the library with buffer management. Thanks for the link.

@arivera12 arivera12 added bug Something isn't working enhancement New feature or request blazor server This is related to blazor server side labels Jun 10, 2020
@Smurf-IV
Copy link

Smurf-IV commented Jul 8, 2020

Can "the buffer management" solution, also have a way of

  • Starting a save
  • Adding many buffers (as they are downloaded to save having to create a single monster ManyGB memory stream and blowing the blazor VM)
  • Committing the save (Or auto dispose if exception thrown etc.)

As per a rework of the gist above ?

@arivera12
Copy link
Owner

@Smurf-IV I transfered your comment into a new issue since sounds promising and a bit complicated because I also found some blazor issues and downsides on stackoverflow.

See the transfered issue here #7

@arivera12
Copy link
Owner

I almost got this. But have been struggling for some hours to fix byte[] and Stream overload methods when converting to base64 for some reason atob works for the first buffer but not for the rest of the buffers in my test example. Base64 string buffered method work perfectly. I may take a deeper look on the weekend. If anyone wants to take a look and help me, this is the commit f64ef3d

@arivera12
Copy link
Owner

Ok I just figured out what was wrong, it won't work after decoding cause the root of the base64 string is need for decoding correctly. I will try another approach I have in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blazor server This is related to blazor server side bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants