System.IO.Exception错误:"不能与用户映射部分文件执行请求的操作开放和QUOT; [英] System.IO.Exception error: "The requested operation cannot be performed on a file with a user-mapped section open."

查看:368
本文介绍了System.IO.Exception错误:"不能与用户映射部分文件执行请求的操作开放和QUOT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

写入到一个XML文件时,我收到一个非常奇怪的IOException异常:

I received a very weird IOException when writing to an XML file:

System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.

   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 System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)
   at System.Xml.XmlDocument.Save(String filename)

发生的错误,当我打电话的XmlDocument的Save(string)方法。

The error happened when I called XmlDocument's Save(string) function.

这是发生了什么事任何想法?

Any ideas on what happened?

推荐答案

看起来像另一个进程使用过的文件映射(共享内存)的API打开该文件。

Looks like another process had the file open using the file mapping (shared memory) APIs.

在Process Explorer的查找功能应该能够告诉你。

The find function in Process Explorer should be able to tell you.

这篇关于System.IO.Exception错误:"不能与用户映射部分文件执行请求的操作开放和QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆