Skip to content

Unable to upload a file #7

@AcidRaZor

Description

@AcidRaZor

OS: Windows 11
Mapped Z:\ to http://localhost:5000/

The issue occurs when copying a file from C:\ to mapped drive, in any folder.

Sequence of events according to the output window:

PROPFIND is called on root including sub-folder that you're attempting to copy to.
LockAsync fires

Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HN02IR5B83RI", Request id "0HN02IR5B83RI:00000002": An unhandled exception was thrown by the application.

Microsoft.AspNetCore.Connections.ConnectionAbortedException: The connection was aborted by the application.
---> System.InvalidOperationException: Reading is already in progress.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ContentLengthMessageBody.TryReadInternal(ReadResult& readResult)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1MessageBody.OnConsumeAsync()
--- End of inner exception stack trace ---

PUT fires
PROPFIND fires
DELETE fires
LockAsync fires

Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HN02IR5B83RN", Request id "0HN02IR5B83RN:00000002": An unhandled exception was thrown by the application.

Microsoft.AspNetCore.Connections.ConnectionAbortedException: The connection was aborted by the application.
---> System.InvalidOperationException: Reading is already in progress.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ContentLengthMessageBody.TryReadInternal(ReadResult& readResult)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1MessageBody.OnConsumeAsync()
--- End of inner exception stack trace ---

PUT fires
DELETE fires

Running the same PUT via Postman works fine

When stepping through the code, a 0kb file is uploaded initially and the database entry is created, but is reverted via DELETE when it's unsuccessful due to the abovementioned error.

This would appear to be a long-standing issue in Kestrel not reporting the error correctly. Some indications point to that there is, somewhere, a double-read that occurs on the Request.Body which causes this, but due to a low-level issue in Kestrel, isn't reported correctly.

I've attempted to copy the Request.Body stream and setting the position of the new memory stream to 0. I suspect this is possibly due to Windows' implementation of WebDAV via mapping a drive to the API more than the actual API, however I have seen (older) C# implementations using HTTPListenerContext that appear to work just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions