CreateSubKey导致System

CreateSubKey导致System

本文介绍了CreateSubKey导致System.IO.IOException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Window的服务,该服务使用.Microsoft.Win32在服务的密钥下打开现有密钥(即HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentTEMSet \ services \ MyService \ Status). 注册表 .LocalMachine.CreateSubKey (StatusKeyStr).在大多数情况下,此通话有效;但是,每隔一段时间它会导致System.IO.IOException消息为媒体受到写保护".有没有人看到过与CreateSubKey相关的特定异常,并且有 对引起异常的原因有什么想法?

I have a Window's service that opens an existing key under the service's key (i.e. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyService\Status) using Microsoft.Win32.Registry.LocalMachine.CreateSubKey (StatusKeyStr). Most of the time this call work; however, every once in a while it causes a System.IO.IOException with a message of "The media is write protected".  Has anyone seen this particular exception associated with CreateSubKey and have any idea of what's causing the exception?

推荐答案

如果您的服务处于打开状态,那么授予您对该服务的管理员权限将会很可怕.

If your service is open then it would be scary if you grant admin permission to the service.

最诚挚的问候,

克里斯蒂安


这篇关于CreateSubKey导致System.IO.IOException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 21:58