ASP.NET访问临时目录被拒绝 [英] ASP.NET Access to the temp directory is denied

查看:177
本文介绍了ASP.NET访问临时目录被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天在许多不同的服务器上遇到这个问题。



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



服务器最近没有触及。我唯一想到的是Windows更新打破东西..任何想法?



尝试从asp.net页面访问webservice时发生这种情况

  System.UnauthorizedAccessException:访问临时目录被拒绝。运行XmlSerializer的身份NT AUTHORITY\NETWORK SERVICE没有足够的权限访问临时目录。 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 []类型,String defaultNamespace,证据证据,XmlSerializerCompilerParameters参数,Assembly Assembly,Hashtable程序集)
在System.Xml.Serialization.TempAssembly..ctor(XmlMapping [] xmlMappings,Type [] types,String defaultNamespace,String location,Evidence证据)
在System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping []映射,证据证据)
在System.Web.Services.Protocols.XmlReturn.GetInitializers(LogicalMethodInfo [] methodInfos)
在System.Web.Services.Protocols.HttpServerType..ctor(类型类型)
在System.Web.Services.Protocols.HttpServerProtocol.Initialize()
在System.Web.Services.Protocols.ServerProtocol .SetContext(Type type,H ttpContext上下文,HttpRequest请求,HttpResponse响应)
在System.Web.Services.Protocols.ServerProtocolFactory.Create(类型类型,HttpContext上下文,HttpRequest请求,HttpResponse响应,布尔& abortProcessing)


解决方案

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


I'm experiencing this problem today on many different servers.

System.UnauthorizedAccessException: Access to the temp directory is denied.

The servers were not touched recently. The only thing that comes in my mind is a windows update breaking something.. Any idea?

This happens when trying to access a webservice from an asp.net page

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)

解决方案

Have you checked the permissions on the temp folder? In these cases, the easiest and quickest solution is usually to re-run the aspnet_regiis -i command to re-install the asp.net framework which also resets the permissions on the required folders. Failing that, try using Process Monitor to check what's going on and modify the permissions accordingly.

这篇关于ASP.NET访问临时目录被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆