1.第一种情况:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\4866c718\20ba01f4\App_global.asax.4omftjrn.dll' -- '拒绝访问。 '
解决方法:
Cleaned the "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files" folder
Gave Full permissions to IIS_IUSRS group
Gave Full permissions to "Everone"
Ran the following command too: %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -i
郁闷的是都没能解决我的问题,最后给 "C:\Windows\Temp"文件夹加上 IIS_IUSRS的权限就好了。
2.第二种情况:
CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.net Files\ ....拒绝访问
查了一圈,发现是IIS在运行时编译时,首先将网站所需要的dll文件拷进c:\Windows\temp(或Tmp)文件中,然后再拷进'c:\WINDOWS\Microsoft.Net\Framework\v4.0.30319\Temporary ASP.NET Files\下面。这个问题:当前用户没有写入temp的权限。
解决方法
简单两步:
c:\Windows\temp 加入NetWork Service 和IIS_UserName的写入权限
c:\Windows\Tmp 加入NetWork Service 和IIS_UserName的写入权限