【发布时间】:2009-07-31 11:17:02
【问题描述】:
我试图在模拟下运行一个 ASP.net 2.0 站点,但似乎出了点问题。我在 ASP.Net IIS 配置小程序中撤消了我的更改。
但是现在我被这个错误困住了
System.UnauthorizedAccessException: Access to the temp directory is denied. Identity 'MACHINE\ASPNET' under which XmlSerializer is running does not have sufficient permission to access the temp directory. CodeDom will use the user account the process is using to do the compilation, so if the user doesnt have access to system temp directory, you will not be able to compile. Use Path.GetTempPath() API to find out the temp directory location.
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Evidence evidence)
at System.Web.Services.Protocols.XmlReturn.GetInitializers(LogicalMethodInfo[] methodInfos)
所以我尝试更改临时路径 - 但是 MSDN 没有说明它是如何得出这个值的。我尝试设置 TEMP 和 TMP 环境变量,但这也没有影响它。它仍然指向 C:\Tmp 文件夹,由于某些管理策略,该文件夹被映射为驱动器,显然来自这些部分周围的类似 Mordac 的字符。
更新:似乎该更改现在才生效。 Path.GetTempPath 现在显示我为这 2 个环境变量设置的值。
【问题讨论】:
标签: c# path asp.net-2.0