Wednesday, August 18, 2010

ASP.Net file too large or exceeded buffer (ASP0251)

I've run into this problem a few times.  The problem is ASP's default is to limit the file buffer to 4MB.  If you get a file (or response) larger than that, it will choke.

In IIS6/7, you can run this command:
  • Click Start, click Run, type cmd, and then click OK.
  • cd /d %systemdrive%\inetpub\adminscripts
  • cscript.exe adsutil.vbs SET w3svc/aspbufferinglimit 20000000

I just found the setting in IIS7.5 in IIS Manager:

Sites -> Default Web Site -> Choose your site
Double Click on the "ASP" feature
Expand "Limits Properties"
Change the "Response Buffering Limit"

It defaults to : 4194304 (4MB)
I changed it to 10000000 (10MB) and clicked Apply, but still got the error
Then, I changed it to 20000000 (20MB), and the error went away

Wednesday, August 4, 2010

Database Restore Script

This is a quick database restore script.  It sets the database to SINGLE_USER so you don't get any "database in use" errors, then restores the database, then sets it back to MULTI_USER.

You need to run all the commands together.  It didn't work for me when I tried to run them separately.



   1:  ALTER DATABASE MyAppDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
   2:    RESTORE DATABASE MyAppDB FROM DISK = 'E:\DBBackups\MyApp_db_201008032143.BAK' WITH REPLACE
   3:    ALTER DATABASE MyAppDB SET MULTI_USER