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

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

xjtudll7年前 (2019-04-09)技术心得5850

现象:

在某一台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://xjtudll.cn/Exp/541/

标签: C#
分享给朋友:

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

BL51: WARNING L13 (RECURSIVE CALL TO SEGMENT) WITH CONSTANTS 解决

问题描述:   将函数名存储在table里,通过函数指针的方式调用函数。 编译提示: BL51: WARNING L13 (RECURSIVE CALL TO SEGMENT) WITH CONSTANTS 使用环境: C51 Version 7.00 代码例程(使用Keil官方资料来说...

紫外线擦除程序

无意中得知,tenx十速的TM89系列OTP单片机可以用紫外线擦除程序,这下让我们在初期调试程序的时候节省了不少。以前都是用一个demo板,将程序烧到demo板的EEPROM里,来仿真效果。现在就不用这样折腾了,直接烧录进去,觉得程序有bug,就用紫外线擦除程序,重新烧录。 网上搜了搜关于紫外线擦...

PHP安装之后没有php.ini文件

问题: 多数教程都说修改php.ini,但是在安装目录里找了半天,根本没有php.ini,只有: php.ini-development php.ini-production 答案: 其实php.ini就是上述两个文件任选一修改而来。 当然,测试的话更合适的是php.ini-develo...

CVS迁移SVN

CVS迁移SVN

1、下载 CVS2SVN http://cvs2svn.tigris.org/files/documents/1462/49543/cvs2svn-2.5.0.tar.gz 2、下载 和安装python 需要把python的安装目录加入环境变量path中. 如果安装的时候没有选择加入环境变量,...

金蝶 从旧账套拷贝供应链单据的自定义字段到全新帐套

金蝶 从旧账套拷贝供应链单据的自定义字段到全新帐套

补充几点:1、K3的官方的工具(K3单据自定义字段复制工具),要求在官方服务期,否则工具直接报错 2、涉及的表应该有以下几个:GLNoteCitationGLNoteTypeICChatBillTitleICClassTableInfoICClassTableInfoLayoutICTemplate...

MSP430 C语言的关键字扩展

1.interrupt 用于中断函数。 定义如下: 语法: interrupt void 函数名()          或者        interrupt[中断向量]void...

发表评论

访客

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