当前位置:首页 > 技术心得 > 正文内容

C# XmlSerializer无法创建文件或目录

xjtudll8年前 (2019-04-09)技术心得8630

现象:

在某一台XP机器上,时而正常,时而弹出无法创建文件或目录

错误具体信息:

在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

在 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, Boolean useLongPath)

在 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

在 Microsoft.CSharp.CSharpCodeGenerator.GetResponseFileCmdArgs(CompilerParameters options, String cmdArgs)

在 Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)

在 Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)

在 Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)

在 System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)

在 System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)

在 System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)

在 System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)

在 System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)

在 System.Xml.Serialization.XmlSerializer..ctor(Type type)

在 XonixERP.Common.AppConfigSetting.get_Config()

在 DLL.ERP.WinFormUI.ClassUtil.CreateInstance(Type type)

在 XonixERP.View.LogonForm.btnLogin_Click(Object sender, EventArgs e)

在 System.Windows.Forms.Control.OnClick(EventArgs e)

在 System.Windows.Forms.Button.OnClick(EventArgs e)

在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

在 System.Windows.Forms.Control.WndProc(Message& m)

在 System.Windows.Forms.ButtonBase.WndProc(Message& m)

在 System.Windows.Forms.Button.WndProc(Message& m)

在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

原因分析:XmlSerializer 运行时所属的帐户或安全环境需要有访问temp 目录的权限

解决办法:

更改权限

1、若C盘是FAT格式,需要将TEMP目录,TMP目录迁移。若C盘是NTFS格式,可跳过此步。

470b234a-2ee7-48c8-8188-a34949ec08a2

2、迁移到NTFS目录后,修改目录权限,允许登录的账户读写

如果没有安全选项卡

点掉"使用简单文件共享",是取消掉它,而不是勾上,一定要注意这一点

a0512321-8320-4439-a893-26f9868cb65c

有没有发现,"安全"选项卡已经出来了

c5e14fa3-0b1c-41ec-a902-f8514576a952

扫描二维码推送至手机访问。

版权声明:本文由鸟的天空发布,如需转载请注明出处。

本文链接:http://www.xjtudll.cn/Exp/541/

标签: C#
分享给朋友:

“C# XmlSerializer无法创建文件或目录” 的相关文章

销售订单序时簿中过滤界面中,【名称】的下拉列表中无法选择到【购货单位】,也就是无法按【购货单位】过滤销售订单?

【操作步骤】  1、使用有权限的用户登录K3主界面后,单击左上角【系统】→【K/3BOS】,输入用户名及密码,登入账套,依次单击打开【供应链】→【销售管理】,找出业务单据销售订单并双击打开;  2、单击菜单【编辑】-【序时簿设置】,找到字段【购货单位$】,并单击选择对应【过滤列表...

销售订单序时簿中过滤界面中,【名称】的下拉列表中无法选择到【购货单位】,也就是无法按【购货单位】过滤销售订单?

【操作步骤】   1、使用有权限的用户登录K3主界面后,单击左上角【系统】→【K/3BOS】,输入用户名及密码,登入账套,依次单击打开【供应链】→【销售管理】,找出业务单据销售订单并双击打开;   2、单击菜单【编辑】-【序时簿设置】,找到字段【购货单位$】,...

iPhone下xib转成iPad的xib

iPhone下xib转成iPad的xib

参考文献:http://blog.csdn.net/kmyhy/article/details/7715397 在Xcode 3中,将xib从iPhone版转变为iPad版,通过Create iPad Version菜单。 但在Xcode 4及Xcode5中,这个菜单找不到了。但是可以通过其...

MultiSelectListPreference 由于xml存在问题而崩溃

参考资料: http://stackoverflow.com/questions/28687681/multiselectlistpreference-crashes-with-dependency 问题描述: 添加了一个MultiSelectListPreference,然后一运行程序,就崩溃了。...

Protel 99SE PCB 与SCH 的比较

Protel 99SE PCB 与SCH 的比较

这个功能主要是比较原理图和PCB的不同,当然如果你的PCB是由原理图Update而来的话,自然两者就是相同的。 第一步:将SCH生成Netlist. (Design /Greate Netlist) 第二步:将PCB生成Netlist. PCB 生成Netlist 的步骤如下: ① 打开PCB文件...

android禁止屏幕自动锁屏(或背光自动灭)

  Android开发过程中,一些程序在运行时,不希望手机自动锁屏,即保持系统的背景灯常亮,以防止程序执行时出现异常,实现起来很简单,只需要在创建Activity时,在onCreate()方法中,加入如下语句即可。   getWindow().addFlags(WindowMan...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。