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

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

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

现象:

在某一台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无法创建文件或目录” 的相关文章

ESD保护方法

ESD保护方法

为了给电子系统提供ESD保护,可以从不同的角度来着手。 一种方法是在半导体芯片内建ESD保护架构。不过,日趋缩小的CMOS芯片已经越来越不足以承受进行内部2 kV等级的ESD保护所需要的面积。 其次,也可以在物理电路设计方面下功夫,较敏感的电路元件应该尽量远离通孔或接缝处,如果可能的话,线缆连接...

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

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

Source Insight删除半个汉字问题

Source Insight删除半个汉字问题

Source Insight(汉化版)下载地址: http://www.onlinedown.net/soft/32292.htm 解压后,文件夹“搞定SourceInsight的半个汉字的问题”,我们需要的是文件SuperBackspace.em。 软件(宏)自带的使用说明...

BMP2PCB使用教程

BMP2PCB使用教程

BMP2PCB是一款将BMP图片转换成PCB图的工具软件,我们可以用它在Protel99SE中添加汉字或图形。如果要添加文字的话,首先就要将文字转化成图片了。需要注意的是,图片最好是单色位图。可先将BMP转化成单色位图,如图所示。 新版的BMP2PCB不仅仅支持转换成Protel PCB格式,...

SQL去掉小数点有效数字后的所有0

第一种方法 select cast(2.5000000000000   as  real) select cast(2   as  real) select cast(2.00000   as  r...

找不到System.Web.dll

找不到System.Web.dll

  这个其实是编译配置选错了。Client Profile里不包含System.Web.dll,只有完整的.Net才有这个。...

发表评论

访客

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