System.UnauthorizedAccessException in mscorlib.dll

10,647

The Temporary ASP.NET Files it is where .NET dynamically store your compiled site. For example every *.cs file in App_Code folder will be built into a i23y4ui.dll and moved to a 247ksdfklj folder. Those names are formed dynamically as well.

What I would recommend is that

Option #1:

On your DEV machine you

  • go to this folder:

    C: \Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\

  • Stop IIS or IIS Express

  • and delete everything inside the folder. This will force your application to recompile entirely.

Option #2:

Is to start your Visual Studio as administrator. Sometimes of the windows options are kind of locked for some users and this may also cause this error. This happens more often when the site is hosted in IIS.

Option #3:

Create a folder with FULL access to "EVERYONE" and set it in your compile element in the web.config

<system.web>
            <compilation tempDirectory="C:\MyCompilationTest\temporary_asp_net_files\test1" />
        </system.web>
Share:
10,647

Related videos on Youtube

Daniel Schneider
Author by

Daniel Schneider

Updated on June 04, 2022

Comments

  • Daniel Schneider
    Daniel Schneider almost 2 years

    I was developing an ASP.NET application. Then I did not test the application in the debugger of Visual Studio, but transferred it via File Deploy to another server. The application works there.

    After I shut down the computer, I wanted to develop again. Since then, I can no longer launch my application in the Visual Studio debugger / IIS. The following error message always appears:

    Exception raised: "System.UnauthorizedAccessException" in mscorlib.dll ("The access to the path" C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files \ AspCheck_b8e5127411412.tmp "was denied." )

    The mentioned path does not contain any file.

    Why are there no more assemblies any more? Is this a special setting that was made when I was publishing to another destination?

    I would appreciate your help!

    • Christopher
      Christopher over 5 years
      I get the feeling the folder called Temporary ASP.NET Files was either deleted or not replicated, on acount of it being a Temporary folder.
    • Daniel Schneider
      Daniel Schneider over 5 years
      @Christopher But why? And how do I get the files back? I am totally sure that I did not delete them manually.
  • Daniel Schneider
    Daniel Schneider over 5 years
    Option #1: The folder is already empty. I think this is the problem. I am using the IIS of Visual Studio. This should be restarted everytime I start debugging? Option #2: Does not work for me either.
  • Dalorzo
    Dalorzo over 5 years
    @DanielSchneider I am running out of options :D, I hope option #3 can help you.