FileNotFoundException, Could not find file 'C:\WINDOWS\TEMP\wpbzwlwo.dll'.

今日服务异常器抛一怪异问题。 在Xml序列化时提示:FileNotFoundException, Could not find file 'C:\WINDOWS\TEMP\wpbzwlwo.dll'.

    Stack trace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
   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.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type)
   at SolutionName.CommonClassname.XmlHelper.Serialize[T](T entity)
   at SolutionName.Bizprocess.Classname.Methodname(Int32 paramter)
 


经网上查阅, 原来这是个服务器执行权限问题。 站点进程由inetinfo.exe以管理员权限创建, w3wp启动时会附加这个站点(window station)运行,但它不是一个Console process,当子进程csc.exe开始处理请求时, 会使用默认的window station Service-0x0-luid$ 重新创建Console information ,导致运行权限不足。

因此,可以通过配置应用程序池标识设置管理员组来解决这个问题。

你可能感兴趣的:(C#,操作系统)