A day with .Net

My day to day experince in .net

Posts Tagged ‘Access is denied’

Amzon AWS Windows Server 2016 hosting -Could not write to output file

Posted by vivekcek on November 2, 2016

I was trying to host an ASP.NET 4.5 application in an Amazon EC2 instance (Windows Server 2016)

Then i got below error

CS0016: Could not write to output file ‘c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\6a5d994b\b5f46f1c\App_global.asax.o34wdr3q.dll’ — ‘Access is denied. ‘

We can solve this by below power shell script

$dir = "C:\Windows\Temp"
$acl = get-acl -path $dir
$new = "IIS_IUSRS","FullControl","ContainerInherit,ObjectInherit","None","Allow"
$accessRule = new-object System.Security.AccessControl.FileSystemAccessRule $new
$acl.SetAccessRule($accessRule)
$acl | Set-Acl $dir

Posted in Amazon AWS | Tagged: , | Leave a Comment »