After upgrading Windows Server to 2016, errors occur in the .Net program irregularly

AnnieNScom 0 Reputation points
2024-04-18T09:17:15.1766667+00:00

The .net program is running on WindowsServer A.

The .net Program call a WebServer on WindwosServer B.

After we upgrade the Windows Server A from 2012 to 2016. errors occur in the .Net program irregularly.

error Message :

Access to temporary directory denied

The execution of XmlSerializer using '--the Account use for WindowsServerB--' identified insufficient permissions to access the temporary directory. CodeDom will perform compilation using the user account used by this handler, so if the user does not have access to the system temporary directory, you will not be able to compile. Please use the Path.GetTempPath() API to find the temporary directory location.

Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,374 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Hania Lian 8,106 Reputation points Microsoft Vendor
    2024-04-22T06:40:19.5466667+00:00

    Hello,

    It sounds like the .NET program you’re running is having trouble accessing temporary folders on the server. This could potentially be due to permissions not being updated correctly during the migration from Windows Server 2012 to 2016.

    Here are some steps you could take to check:

    Update the permissions: Whatever account your .NET program is running under needs to have read/write permissions for the system temporary directory via Ntfs permissions.

    Manually check the permissions for this account on this directory by going to the folder, right-clicking and selecting Properties, then the Security tab. Ensure that the user the .NET Program is running under has read/write/execute permissions.

    Another possible cause could be that .Net runtime’s inability to create temp files in the servers’ temp folder. Determine which directory is the temporary directory (by using Path.GetTempPath() API as suggested in the error message) and verify that the account in question has proper permissions to that directory. I consider that you could try to use process monitor tool to capture the trace to analysis。

    Sometimes, security programs can interfere with code execution and restrict access to certain folders. Check and adjust the settings of your antivirus software so that the .NET Program can access the necessary folders.

    Restart the Application Pool: If the application is running on IIS, it might be using the user profile of the application pool identity user. If this user doesn’t have a profile directory or doesn’t have the right permissions, it could cause issues. Restarting the application pool, or even the whole web server, may solve the problem.

    Reinstall or Repair.NET: There could be a problem with your .NET installation. Try repairing or reinstalling the .NET framework.

    Best Regards,

    Hania Lian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.


  2. AnnieNScom 0 Reputation points
    2024-04-29T07:37:30.4133333+00:00

    .Net programs execute once every minute. This error is occurs irregularly. Maybe once or twice a day. Other times it always works out. so this account have the read/write permissions for the system temporary directory.

    Do you have any other suggestions about this issue ?

    0 comments No comments