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!
ASP.NET.NET Programming

Avatar of undefined
Last Comment
infotechelg

8/22/2022 - Mon
Emmanuel Adebayo

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
Abhigyan Srivastava

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
Abhigyan Srivastava

server\user is the user you are using i.e. in your case server_name\Network Services
Your help has saved me hundreds of hours of internet surfing.
fblack61
Abhigyan Srivastava

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

ASKER
infotechelg

Thanks. Before I run this, will this cause IIS to break or anything? Should I run it after-hours? Or, is it pretty harmless?
ASKER
infotechelg

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.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Abhigyan Srivastava

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.
Abhigyan Srivastava

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.
Abhigyan Srivastava

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.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER
infotechelg

Thanks! I'll give it shot after-hours and let you know if there are any more reports tomorrow of the issue happening.
ASKER
infotechelg

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"?
Abhigyan Srivastava

Actual Server Name\Network Service.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
infotechelg

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
infotechelg

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.