WPF。隔离存储文件名长度
为了保存我的配置数据,我使用隔离的存储域范围,例如:
IsolatedStorageFile isoFile =
IsolatedStorageFile.GetUserStoreForDomain();
但有时在保存数据时我得到:
System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---> System.IO.PathTooLongException: The specified path,
file name, or both are too long. The fully qualified file name must be less than
260 characters, and the directory name must be less than 248 characters.
at System.IO.PathHelper.Append(Char value)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
好吧,我的文件名太长了。但我无法控制它。另外,我无法使用应用程序范围,因为我不使用 ClickOnce。
那我该怎么办呢? 谢谢
For save my configuration_data I use isolated stoeage domain scope like:
IsolatedStorageFile isoFile =
IsolatedStorageFile.GetUserStoreForDomain();
But sometimes at saving data I get:
System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---> System.IO.PathTooLongException: The specified path,
file name, or both are too long. The fully qualified file name must be less than
260 characters, and the directory name must be less than 248 characters.
at System.IO.PathHelper.Append(Char value)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
Ok my fileName is too long. But I can't control it. Also I can't use application scope, cause I don't use ClickOnce.
So what should I do?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是IsolatedStorage 的一个已知问题。
您可以使用用户配置文件 (AppData) 来存储您的信息,而不是使用isolatedStorage API。
This is a known issue with IsolatedStorage.
You could use the user profile (AppData) to store your information as apposed to the IsolatedStorage API.