When upgrading ArcGIS Server 10.5 and Portal for ArcGIS 10.5 you may encounter following error message:
Reason: This error occurs because files utilized while upgrading are detected as a security threat by Anti-virus and Desktop Protection Software, even though they are harmless.
Solution: There are two ways you can resolve this issue:
1. Disable all Anti-virus, Desktop protection, and Local Firewall protection through Windows Service Management. This is only necessary at the time of the upgrading software‘s.
2. Configure your Anti-virus, Desktop protection, and Local Firewall protection to temporarily “trust” files that produce the 1304 Error. This is not a recommended procedure. However, you can use this method as a temporary work-around should the primary method fail.
来源:https://geonet.esri.com/ideas/13351-error-1304-error-writing-to-file-verify-that-you-have-access-to-that-directory