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

HttpWebRequest.GetRequestStream returned stream does not send data immediately in .NET Core #45871

Closed
manureini opened this issue Dec 9, 2020 · 7 comments
Milestone

Comments

@manureini
Copy link

manureini commented Dec 9, 2020

I try to upload a large file with HttpWebRequest in .NET Core or .NET 5, but a "IOException: Stream was too long." is thrown.

The request is not send immediately and is somehow buffered.

repro:
https://stackoverflow.com/questions/61383052/httpwebrequest-getrequeststream-returned-stream-does-not-send-data-immediately-i

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Net untriaged New issue has not been triaged by the area owner labels Dec 9, 2020
@ghost
Copy link

ghost commented Dec 9, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

I try to upload a large file with HttpWebRequest in .NET Core or .NET 5 , but a "IOException: Stream was too long." is thrown.

The request is not send immediately and is somehow buffered.

repro:
https://stackoverflow.com/questions/61383052/httpwebrequest-getrequeststream-returned-stream-does-not-send-data-immediately-i

Author: manureini
Assignees: -
Labels:

area-System.Net, untriaged

Milestone: -

@wfurt
Copy link
Member

wfurt commented Dec 9, 2020

How big is the file? Do you have simple app to outline the code you use?

@manureini
Copy link
Author

The file is around 8GB. I was able to use the HttpClient insted HttpWebRequest to workaround this issue

@wfurt
Copy link
Member

wfurt commented Dec 10, 2020

That is good to know. This feels like we have int somewhere and that wraps around.

@stephentoub
Copy link
Member

I expect this is the same issue as #18632 (albeit for GetRequestStream instead of GetRequestStreamAsync).

@manureini
Copy link
Author

Yes could be a similar issue.
I'm able to workaround this with the HttpClient.
Thanks to the guy who helped on Stackoverflow ;)

@karelz
Copy link
Member

karelz commented Dec 17, 2020

Duplicate of #18632

@karelz karelz marked this as a duplicate of #18632 Dec 17, 2020
@karelz karelz closed this as completed Dec 17, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 16, 2021
@karelz karelz added this to the 6.0.0 milestone Jan 26, 2021
@karelz karelz removed the untriaged New issue has not been triaged by the area owner label Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants