After publishing a new APS.net site to IIS, one of the functions of the site was failing which was (of course) working on my virtual machine used for development.

The issue was with a file upload and it kept returning me the error on the logs “Error writing MIME multipart body part to output stream”.

It turns out when you publish there is a temporary folder which you set in code that hold the stream and then, once uploaded performs your tasks.

Dim root As String = HttpContext.Current.Server.MapPath("~/App_Data")

NewImage

To solve this you simply have to add this folder to the virtual folder that hold your site and you will be good to go.

Hope this helps!