Link to home
Start Free TrialLog in
Avatar of infotechelg
infotechelgFlag for United States of America

asked on

Intermittent .NET Error

Yesterday, I had a user report to me the following error on our live site:

The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files'.
However, I was not able to reproduce the error. So I just wrote it off as a fluke.

Today, a co-worker sitting next to me was browsing one of our live sites and came upon the error. All I had to do was reload the page and the error went away. It hasn't happened since, but I'm worried it'll happen again.

Any ideas why this would just randomly happen, and any ideas on how to fix it?

Please let me know if you require any other information.

Thanks in advance!
Avatar of Emmanuel Adebayo
Emmanuel Adebayo
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi,

Was there any error log in the event viewer when this incident occured?

Ensure that "Network Services" or whichever account you are using to run the application pool has write permission to :\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET.

This can occur when proprietary Windows security policies prohibit proper access from being set for this directory during installation.

I hope this helps
Try this:
Open command prompt as administrator and run the below command.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Aspnet_regiis.exe -ga server\user

Open in new window


This gives that user access to the iis configuration and other directories used by ASP.NET
server\user is the user you are using i.e. in your case server_name\Network Services
And if you are on a 32 bit system them

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Aspnet_regiis.exe -ga server\user

                                          

Open in new window

Avatar of infotechelg

ASKER

Thanks. Before I run this, will this cause IIS to break or anything? Should I run it after-hours? Or, is it pretty harmless?
Also, I'd like to understand why this, seemingly out of the blue, just started happening. This server and these sites have been running for years and this has never happened before.

Any insight would be greatly appreciated.
It wont break IIS or anything. It will just give the rights to Network Service. If your site has live users then you can do it after hours or if you can bear with a downtime of 10-30 seconds, do it now.
There seems to be a bug in ASP.NET 3.5 which sometimes did not allow the user rights to the folder. Though Microsoft is silent on if the bug is also in v4.0 and v4.5, users have faced this issue and used this to solve the issue.

Primarily the reason it seems is that the folder being used by another app pool at the moment or by any other user. Over all a mysterious bug just like another one that comes with aspnet membership. It fails rarely with a general failure.
This solution has worked for most. A more basic solution is running

aspnet_regiis -i

Open in new window


from command prompt as Administrator. Just replace -ga server\user with the flag -i.
Thanks! I'll give it shot after-hours and let you know if there are any more reports tomorrow of the issue happening.
Just to be sure, for "server\user" do I use "NT AUTHORITY\NETWORK SERVICE" that was in the error, or am I using the actual server name for "server"? "SERVERNAME\NETWORK SERVICE"?
Actual Server Name\Network Service.
ASKER CERTIFIED SOLUTION
Avatar of infotechelg
infotechelg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, everyone for your input. It turned out to be that one of the server's C:\ drive was too low on space. Hopefully this will help someone else in the future.