错误信息:
----------------------------------------------------
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0016: 未能写入输出文件“C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/5177u/d087da43/c12930d8/YD.dll”--“拒绝访问。 ”
解决办法:
给系统目录(Windows)下temp,tmp两个目录加Network service用户,并赋予所有权限,然后修改环境变量中相映的值就可以了(temp变量的值改为%SystemRoot%/temp,tmp变量的值改为%SystemRoot%/tmp)。然后开始-->运行中输入iisreset重起服务即可了:)
下面是微软网站的原文:(http://support.microsoft.com/default.aspx?scid=kb;en-us;825791)
SYMPTOMS
When you view a Microsoft ASP.NET Application in a Web browser, you may receive the following error messages:
For the Microsoft .NET Framework version 1.1, the error message is the following:
CS0016: Could not write to output file 'c:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/application1/c11b43f6/cf3ec03/rizcntet.dll' . The directory name is invalid.
For the .NET Framework 1.0, the error message is the following:
CS0013: Unexpected error writing metadata to file 'C:/WINDOWS/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/application2/3fc72f26/eb731247/ev2bslce.dll'. The directory name is invalid.
Back to the top
CAUSE
The system TEMP and TMP variables point to a folder that does not exist. The compiler generates temporary files in the folder where the TEMP and the TMP variables point to before the files are copied to the Temporary ASP.NET Files folder. However, the folder where the system variables point to is deleted when you restart the computer. Therefore, the compiler cannot generate the temporary files.
Back to the top
RESOLUTION
1. Create a temporary folder under %Systemroot%, and then name it Temp.
2. Grant full permissions on the Temp folder to the aspnet user account in .NET Framework 1.0 or to the NETWORK SERVICE user account in .NET Framework 1.1.
3. Right-click My Computer, and then click Properties.
4. On the Advanced tab, click Environment Variables.
5. Select the TEMP variable under System variables, and then click Edit.
6. Type %SystemRoot%/TEMP in the Variable Value box, and then click OK.
7. Repeat steps 5 and 6 to edit the TMP variable. Click OK two times.
8. Click Start, and then click Run.
9. To reset Internet Information Services (IIS), type iisreset on the command prompt.
Note If the error message that is mentioned in the "Symptoms" section of this article persists, restart the computer.
Back to the top
MORE INFORMATION
Steps to Reproduce the Behavior
1. Start Microsoft Visual Studio .NET.
2. Create a new ASP.NET Web Application project by using Microsoft Visual C# .NET or Microsoft Visual Basic .NET, and then name the project CompileTest.
3. On the Build menu, click Build Solution.
4. Right-click My Computer, and then click Properties.
5. On the Advanced tab, click Environment Variables.
6. Select the TEMP variable under System variables, and then click Edit.
7. Type %SystemRoot%/TEMP1 in the Variable Value box to point to the nonexistent TEMP1 folder, and then click OK.
8. Repeat steps 6 and 7 to edit the TMP variable to point to the nonexistent TEMP1 folder.
9. Click OK two times.
10. To notice one of the error messages that are mentioned in the "Symptoms" section of this article, visit the following URL: http://localhost/CompileTest/WebForm1.aspx
Back to the top
REFERENCES
For more information about how to grant permissions to a folder, visit the following Microsoft Developer Network (MSDN) Web site:
Securing Your ASP.NET Application and Web Services
http://msdn2.microsoft.com/en-us/library/aa302435.aspx (http://msdn2.microsoft.com/en-us/library/aa302435.aspx)