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

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

问题描述

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

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

该服务器没有最近感动。自带在我心中的唯一事情是Windows更新打破东西..任何想法?

这恰好试图从一个asp.net页面访问WebService时,

  System.UnauthorizedAccessException:对临时目录被拒绝。身份'NT AUTHORITY \\ NETWORK SERVICE下的XmlSerializer运行的是没有足够的权限来访问temp目录。 codeDOM将使用用户帐号的过程是用做编写,因此如果用户不必须访问系统临时目录,你将无法进行编译。使用Path.GetTempPath()API来找出临时目录位置。
       在System.Xml.Serialization.Compiler.Compile(大会父,字符串NS,XmlSerializerCompilerParameters xmlParameters,证据证据)
       在System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping [] xmlMappings,类型[]类型,字符串defaultNamespace,证据证据,XmlSerializerCompilerParameters参数,装配装配,装配哈希表)
       在System.Xml.Serialization.TempAssembly..ctor(XmlMapping [] xmlMappings,类型[]类型,字符串defaultNamespace,字符串位置,证据证据)
       在System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping []映射,证据证据)
       在System.Web.Services.Protocols.XmlReturn.GetInitializers(LogicalMethodInfo [] methodInfos)
       在System.Web.Services.Protocols.HttpServerType..ctor(type类型)
       在System.Web.Services.Protocols.HttpServerProtocol.Initialize()
       在System.Web.Services.Protocols.ServerProtocol.SetContext(类型类型,HttpContext的背景下,Htt的prequest请求的Htt presponse响应)
       在System.Web.Services.Protocols.ServerProtocolFactory.Create(类型类型,HttpContext的背景下,Htt的prequest请求的Htt presponse响应,布尔和放大器; 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天全站免登陆