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的权限就可以了!!!

  • 相关阅读:
    Python查找最新测试报告到邮件功能
    windows下如何安装pip以及如何查看pip是否已经安装成功
    selenium之 chromedriver与chrome版本映射表(更新至v2.33)
    selenium 获取input输入框中的值的方法
    iframe 内联框架
    frameset导航框架
    html 7.28
    存储器
    递增输出带表头结点的单链表元素
    从头到尾反向输出带头结点的单链表的每个节点的值
  • 原文地址:https://www.cnblogs.com/blackcore/p/2054786.html
Copyright © 2011-2022 走看看