Solution to my UnauthorizedAccessException problem – level -1000
Yesterday afternoon, my web application broke. I have a page that takes a user data file and saves it to the server. I have a web service that takes the contents of a file and does the same thing. A process consumes these files on our development server. I am developing part of it on my machine and dropping the file to the DEV machine for consumption, so I’m creating files on a UNC path. Mysteriously I started getting UnauthorizedAccessException, but my code had been working. I didn’t change anything. I double-checked all the important stuff (identity impersonation, security, etc), and everything was in order. I did the normal research. . . Google groups. For all of you Googlers out there having problems with this exception, I have a solution. Reboot! I checked everything I could think of, and I remembered the rule of thumb that I always tell everyone else: “When in doubt, reboot.” Since I’ve been using Win XP and now 2003 Server as my dev OS, I haven’t had to do much rebooting. My home computer (XP Pro) hasn’t been rebooted in at least two months, and it gets a lot of abuse as well as having umpteen external devices connected to it.
I’m using Windows Server 2003, and it is very stable, and even with the abuse I put it through, this was the first time I’d rebooted this week. It’s a laptop, so I hibernate it. I rarely reboot, but remember that when there is no rational explanation for a problem. . . reboot.
When I was assigned to the network help desk, if I couldn’t solve the problem quickly, I always had the user reboot. Meanwhile, I was googling like hell. The reboot usually either fixed the problem, or bought me enough time to find the answer.