My blog has moved! Redirecting…

You should be automatically redirected. If not, visit http://www.digitalfugu.com/blog/ and update your bookmarks.

Friday, August 24, 2007

ASP.NET Can't write to output file ... The directory name is invalid

We just re-purposed an old dual P3 xeon box to be an external web server so that we can test our web application without driving our mission critical hosting costs through the roof with bandwidth charges. This server is an old chassis with three HDDs. We put IIS, .Net frameworks 1.1 and 2.0, and SQL Server 2005 on there. Ran our server installer and were quivering with anticipation of the oodles of tests we were about to perform.

Alas this was not to be. When we browsed to our site, we were greeted with an error "Can't write to output file ... The directory name is invalid." We checked and the asp.net network_service accounts both had full access to the directory mentioned in the error message. After some digging, it turns out that the network_service wasn't having an issue with the named directory. What it really had a problem with was the system defined TEMP and TMP environment variables. They were pointing to some erroneous location that didn't even exist. So the fix is like this.
  1. Open the Advanced Tab in "System Properties"
  2. Click "Environment Variables"
  3. Under "System variables" check out TMP and TEMP. These should point to a proper location. You can either modify them to point to an existing directory or create the directory that they point to.
  4. Configure security so that Network_service has full control on those locations.
  5. Restart IIS
Just so.

No comments: