miércoles, 25 de abril de 2018

ASP Temporary ASP.Net Files folder filling up causing system writer to disappear

 > 


    Question

  • Hi there!
    I'm finding that Temp ASP .NET folders from C:\Windows\Microsoft.NET\Framework and Framework64 are filling up even after I delete the content.
    This is causing my System Writer to disappear which makes the backup fail.
    Could someone please tell me how I can stop these files from being created/growing or have them recycle.
    Thanks.
    PS - This is a Server 2012 R2 Essentials 64x Server.
  • nswers

    • Okay.
      I believe I have managed to fix my problem permanently without the use of daily scripts etc.
      See here for a detailed explanation of the issue along with a detailed guide to resolve it. Kudos to crutledge from Peer Wisdom who made this guide.
      The fix is to relocation the ASP.NET temp folder which is outside of the system state backup.
      Create the new temp directory
      The first thing we need to do is to create new directories for the ASP.NET temporary files.  These commands will create new directories for the ASP.NET 2.0 and 4.0 temporary files on the D drive. You can choose any location, I just followed the guide. 
      md "D:\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"
      md "D:\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
      md "D:\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files"
      md "D:\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"

      Set Folder Permissions
      Next we need to set the folder permissions to match the existing default directories.  The easiest way to do this is with the ICACLS command.  The first command removes the removes the inherited permissions and replaces them with a copy of the inherited permissions.  Thus changes to the permissions of the drive (root directory) will not effect the new temporary directories.  The remaining commands grant the required permissions.
      icacls "D:\Microsoft.NET" /inheritance:d
      icacls "D:\Microsoft.NET" /grant:r "BUILTIN\Administrators:(OI)(CI)(F)"
      icacls "D:\Microsoft.NET" /grant:r "NT AUTHORITY\SYSTEM:(OI)(CI)(F)"
      icacls "D:\Microsoft.NET" /grant:r "CREATOR OWNER:(OI)(CI)(IO)(F)"
      icacls "D:\Microsoft.NET" /grant:r "BUILTIN\IIS_IUSRS:(OI)(CI)(M,WDAC,DC)"
      icacls "D:\Microsoft.NET" /grant:r "BUILTIN\Users:(OI)(CI)(RX)"
      icacls "D:\Microsoft.NET" /grant:r "NT SERVICE\TrustedInstaller:(CI)(F)"
      icacls "D:\Microsoft.NET" /grant:r "NT SERVICE\WMSvc:(OI)(CI)(M,DC)"

      Add Attribute tempDirectory To The compilation Tag In web.config
      For ASP.NET to use temporary directories anywhere other than the default location, the directory must be specified using the tempDirectory attribute of the <compilation> tag in the system web.configfile.  There is one file for each version of the .NET Framework.  (Again, these are the same versions that have ASP.NET temporary directories, so there is no web.config file for .NET 3.0 and 3.5.)  The tempDirectory attribute specifies the directory where the compiled machine code will be cached.  The web.config file is a XML file that can be edited with Notepad.
      For ASP.NET 2.0 32-bit, we would edit the web.config file and locate this tag:
      <compilation>
      and change it as follows to use the new temporary directory:
      <compilation tempDirectory="D:\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files">
      The web.config file is located in the CONFIG folder for the .NET Framework version.  In our example, we will need to edit the following web.config files.
      .NET Framework 2.0 – 32-Bit
      C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config
      .NET Framework 2.0 – 64-Bit
      C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config
      .NET Framework 4.0 – 32-Bit
      C:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG\web.config
      .NET Framework 4.0 – 64-Bit
      C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\web.config
      Restart IIS
      For the changes made to the web.config files to take effect, IIS has to be restarted.  This is easily done from the command line.
      iisreset
      Delete Files In The Old Temporary Directories
      Now we need to delete the files in the old ASP.NET temporary directories so they are no longer part of the system state.  These files are actually in a subfolder named root, so we'll actually delete this folder along with all it's files and subfolders.  Again, this is easily done from the command line.
      rmdir /s /q "C:\Windows\Microsoft.Net\Framework\v2.0.50727\Temporary ASP.NET Files\root"
      rmdir /s /q "C:\Windows\Microsoft.Net\Framework64\v2.0.50727\Temporary ASP.NET Files\root"
      rmdir /s /q "C:\Windows\Microsoft.Net\Framework\v4.0.30319\Temporary ASP.NET Files\root"
      rmdir /s /q "C:\Windows\Microsoft.Net\Framework64\v4.0.30319\Temporary ASP.NET Files\root"
      Restart The Cryptographic Service
      To get the VSS System Writer back, we must restart the service that controls it, which as previously mentioned, was the Cryptographic Service.
      net stop cryptsvc
      net start cryptsvc

      Verifying Everything Is Working

      If you did everything correctly, you should see files created in the new ASP.NET temporary directories the next time the website is accessed.  And to verify the System Writer has returned, run the vssadmincommand to list the writers.

      vssadmin list writers



      • Marked as answer by kieferschild Thursday, April 06, 2017 12:35 PM
      • Edited by kieferschild Thursday, April 06, 2017 12:36 PM v3
      Thursday, April 06, 2017 12:34 PM
      Avatar of kieferschild

No hay comentarios:

Publicar un comentario

  Installing Redis-x64-3.2.100 on Windows and Running Redis Server https://medium.com/@kasunprageethdissanayake/installing-redis-x64-3-2-100...