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.