zoukankan      html  css  js  c++  java
  • CS0016: 未能写入(A compilation error has occurred.HttpCompileException: error CS0016: Could not write to output file 拒绝访问)

    项目部署一直挺好的,今天使用时,突然在日记中报错!

    System.UnauthorizedAccessException: Access to the temp directory is denied. Identity 'IIS APPPOOL\zbs_Remoter_20104' 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 doesn�t have access to system temp directory, you will not be able to compile. Use Path.GetTempPath() API to find out the temp directory location.

    Server stack trace:
    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.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
    at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
    ………………

    在浏览器中,页面返回如下错误信息:

    error CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\62dbbf01\a08ea1a8\App_global.asax.qujxfrcb.dll' -- '拒绝访问。 ' at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) at System.Web.Compilation.BuildManager.CompileGlobalAsax() at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.CallAppInitializeMethod() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
    ……………………
    at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) at System.Web.Compilation.BuildManager.CompileGlobalAsax() at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.CallAppInitializeMethod() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

    很是奇怪,竟然提示:

    CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\62dbbf01\a08ea1a8\App_global.asax.qujxfrcb.dll' -- '拒绝访问。 '

    一直也没动过相关文件夹的权限啊!

    既然说没有权限,就试着把Temporary ASP.NET Files权限提升,发现已经有了IIS_USERS权限了,难道还不够,索性就再给了Netword Services和Everyone所有权限,重启IIS后还是不行。然后我就把c:\Windows\Temp文件夹权限也提升和Temporary ASP.NET Files一样,再次重启IIS,访问站点,呃,竟然可以了!把Everyone权限移除也可以!

    最后我不明所以,望高人指点,这样设置也太没有安全性可言了!

    注:只要设置C:\Windows\Temp的权限就可以了!!!

  • 相关阅读:
    【原】用IDEA远程Debug Tomcat服务
    【原】getInputStream()与getParameterMap()获得Post请求的数据区别
    【原】使用Eclipse远程Debug测试环境
    【原】配置MySQL服务器端的字符集
    【原】Spring整合Redis(第三篇)—盘点SDR搭建中易出现的错误
    【原】Spring整合Redis(第二篇)—SDR环境搭建具体步骤
    【原】Spring整合Redis(第一篇)—SDR简述
    【转】InitializingBean的作用
    【原】Redis windows下的环境搭建
    【原】Maven解决jar冲突调试步骤:第三方组件引用不符合要求的javassit导致的相关异常
  • 原文地址:https://www.cnblogs.com/blackcore/p/2054786.html
Copyright © 2011-2022 走看看