Asynchronous file writes

We've now seen how to asynchronously access the database and a web service. Another area where asynchronous coding may bring performance benefits is writing files to disc after they have been uploaded using the FileUpload control.

Synchronous version

You'll find this code in the downloaded code bundle in the folder ThreadStarvation_FileWrite_Sync. When you open the website in Visual Studio, you'll find that it stores uploaded files in a folder images. When you publish the website, to enable the website to write files into that folder, give user IIS_IUSRS modify permission to that folder:

  1. Right-click on the images folder. Click on Properties | Security | Edit.
  2. Select IIS_IUSRS in upper-pane (add it if it isn't shown).
  3. Check ...

Get ASP.NET Site Performance Secrets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.