gpt4 book ai didi

c# - ASP.NET 对临时目录的访问被拒绝

转载 作者:可可西里 更新时间:2023-11-01 08:06:27 24 4
gpt4 key购买 nike

我今天在很多不同的服务器上都遇到了这个问题。

System.UnauthorizedAccessException:访问临时目录被拒绝。

最近没有动过服务器。我唯一想到的是 Windows 更新破坏了某些东西。有什么想法吗?

尝试从 asp.net 页面访问网络服务时会发生这种情况

System.UnauthorizedAccessException: Access to the temp directory is denied.  Identity 'NT AUTHORITY\NETWORK SERVICE' 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)
at System.Web.Services.Protocols.HttpServerType..ctor(Type type)
at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

最佳答案

您是否检查过临时文件夹的权限?在这些情况下,最简单和最快捷的解决方案通常是重新运行 aspnet_regiis -i 命令以重新安装 asp.net 框架,这也会重置所需文件夹的权限。如果失败,请尝试使用 Process Monitor检查发生了什么并相应地修改权限。

关于c# - ASP.NET 对临时目录的访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/542312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com