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

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

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

现象:

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

mysql服务无法启动 服务没有报告任何错误

mysql服务无法启动 服务没有报告任何错误

参考资料: http://bbs.csdn.net/topics/391851148 问题描述: 使用net start mysql启动MySQL服务时,提示:MySQL服务无法启动,服务没有报告任何错误。如下图所示: 可能原因: data目录里已经有数据里,所以有冲突。 解决办法: 1、删...

获取NSImage图片的准确大小

问题: NSImage加载图片的时候无法准确获得图片的大小 测试代码: NSImage *image = [NSImage imageNamed:@"image"]; NSLog(@"%f, %f", image.size.width, image.size....

使用ML610Q407模拟仿真ML610Q473

使用ML610Q407模拟仿真ML610Q473

ML610Q473号称是Flash型,本质只是MTP(Multiple Time Programmable),可重复擦写次数80次左右。在开发阶段,如果像51一样,每次都烧录程序看结果,时间不长IC就挂了。ML610Q473自身是不能作为仿真芯片直接仿真的,需要用ML610Q407来模拟仿真。 1、...

ios宏: 判断是否是retina屏,是否iPad,设备判断(4,5,5s,6等)

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) #define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) #def...

运算放大器芯片输出扩流电路三例(转载)

运算放大器芯片输出扩流电路三例(转载)

原文:http://m.elecfans.com/article/207872.html 工作原理:图1所示为三种集成运算放大器输出电流扩展电路,图(a )为双极性扩展电路;图(b)、图(c)为单极性扩展电路。在图1(a )所示电路中,当输出电压为正时,BG1管工作、BG2管截止;输出电压为负时,B...

windows server 2008R2 初始密码策略:老提示密码不符合策略

参考资料: http://zhidao.baidu.com/link?url=52XEZ-w-pIcmk2S-UkB8V1b9NOHJm3kBPECZHwD6WhT7DxofLXu03UsCFN_DqEJ4KJ6UtlL-b7a4c-yNarXfCa 问题: windows...

发表评论

访客

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