错误信息如下:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

System.UnauthorizedAccessException: 拒绝访问临时目录。以其运行 XmlSerializer 的身份“IIS APPPOOL\DefaultAppPool”没有足够的权限访问临时目录。CodeDom 将使用此进程用于进行编译的用户帐户,因此如果用户对系统临时目录没有访问权限,则将无法编译。使用 Path.GetTempPath() API 可找到临时目录位置。 在 System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) 在 System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) 在 System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) 在 System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type) 在 System.Web.Services.Protocols.XmlReturn.GetInitializers(LogicalMethodInfo[] methodInfos) 在 System.Web.Services.Protocols.XmlReturnWriter.GetInitializers(LogicalMethodInfo[] methodInfos) 在 System.Web.Services.Protocols.MimeFormatter.GetInitializers(Type type, LogicalMethodInfo[] methodInfos) 在 System.Web.Services.Protocols.HttpServerType..ctor(Type type) 在 System.Web.Services.Protocols.HttpServerProtocol.Initialize() 在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


环境:WIN7, IIS 7, 64BIT


解决方案:

 开始->运行-> inetmgr -> 在IIS信息管理器中,找到 应用程序池 -> DefaultAppPool -> 右键 设置应用程序池默认设置 -> 标识:LocalSystem (本地系统)  -> 确定. 重启 应用程序池。


效果图

pic-1:

System.UnauthorizedAccessException: 拒绝访问临时目录。以其运行 XmlSerializer 的身份“IIS APPPOOL\DefaultAppPool”没有足够的_xml

pic-2:

System.UnauthorizedAccessException: 拒绝访问临时目录。以其运行 XmlSerializer 的身份“IIS APPPOOL\DefaultAppPool”没有足够的_ide_02


(结束)