1
votes

I am getting a "permission denied" error when I try to open a text file in Perl/IIS for write access.

unless(open FILE, "+<C:\\Folder/Sub/file.txt") {
  die "\nUnable to open $!\n";
}
print FILE "Hello there\n";
close FILE;

My handler in IIS is as follows: C:\Perl64\bin\perl.exe "%s" %s

If I run Perl.exe from the command line in my own account it works, so I know the script is OK and it's NOT therefore an issue with slashes and backslashes. My app pool was running in the Local System account. I changed it to a specific user account and that made no difference. The folder C:\Folder has write access to both accounts I tried it in.

I am running Windows Server 2012 under an Azure VM.

1

1 Answers

1
votes

Figured it out. In IIS, in Features View, double-click CGI. There is an "Impersonate User". That should be changed to False.