I am trying to following this web blog on uploading large files using the Web Api class via Asp.Net Web Forms. If you look through the post you will notice that in order to avoid an out of memory because of buffering of larges files, they recommend overriding the IHostBufferPolicySelector interface. Where do I implement the interface? Do I do it in the Web Api class, in the Global.asax or am I completely off track and need to do the implementation somewhere else?
Share
You don’t need to implement this interface, I only listed it as a reference – that code is already part of Web API source (under
System.Web.Http/Hosting/IHostBufferPolicySelector.cs)What you need to do is override the base class
System.Web.Http.WebHost.WebHostBufferPolicySelectorThis is enough:
and then registering your new class in either
Global.asaxorWebApiConfig.cs(whichever you prefer):