I'm having an issue when posting a file to my web server. I get this exception:
Exception raised during upload handling.
IOException: Error reading MIME multipart body part.StackTrace:
at System.Net.Http.HttpContentMultipartExtensions. <ReadAsMultipartAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Server.Controllers.DataController.d__5.MoveNext()[InvalidOperationException] Unable to read the entity body in bufferless mode. The request stream has already been buffered.
StackTrace:
at System.Web.Http.WebHost.HttpControllerHandler.<>c__DisplayClass18_0.b__1()
at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.get_StreamContent()
at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.CreateContentReadStreamAsync()
at System.Net.Http.HttpContent.ReadAsStreamAsync()
at System.Net.Http.HttpContentMultipartExtensions.d__9`1.MoveNext()
The odd thing is that the server has been installed on many machines but this error only occurs on one server. The other odd thing is that when uploading the file via the website the file uploads fine. But when trying to upload the file using a application that sends the request to the same server endpoint, it gets this error.
The same file has been used on multiple servers without issue. The same application has uploaded files to other servers without issue.
And yes I have read the multiple other posts with the similar issue (e.g. WebAPI error reading MIME multipart body part ) but I still haven't found a solution. The maxRequestLength and maxAllowedContentLength have been set in the web.config.
Is there an IIS setting I'm missing that should be checked that maybe different on that server? What other solutions can I try?
Not sure what other info is needed. Thank you in advance