FrameWork无法运行,出现System.Management.ManagementException 访问遭到拒绝

当你运行FrameWork时,出现以下错误.
System.Management thrown System.Management.ManagementException
访问遭到拒绝
在 System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
在 System.Management.ManagementScope.InitializeGuts(Object o)
在 System.Management.ManagementScope.Initialize()
在 System.Management.ManagementObject.Initialize(Boolean getObject)
在 System.Management.ManagementClass.GetInstances(EnumerationOptions options)
在 System.Management.ManagementClass.GetInstances()
在 FrameWork.Components.sys_FrameWorkInfoTable..ctor()
在 FrameWork.CheckUpdate..ctor()
在 FrameWork.FrameWorkPermission.app_Auth(Object sender, EventArgs e)
在 System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

是由于你的服务器asp.net的运行权限低,导致asp.net进程无法访问System.Management类. 你可以找到FrameWork.Components.sys_FrameWorkInfoTable.cs文件,将其原来的构造函数
        /// <summary>
        /// 构造函数
        /// </summary>
        public sys_FrameWorkInfoTable()
        {
            ManagementClass mc = new ManagementClass("Win32_Processor");
            ManagementObjectCollection moc = mc.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                _S_RegsionGUID = mo.Properties["ProcessorId"].Value.ToString();
                break;
            }
        }
修改为
      /// <summary>
        /// 构造函数
     /// </summary>
        public sys_FrameWorkInfoTable()
        {
            ManagementClass mc = new ManagementClass("Win32_Processor");
            try
            {
                ManagementObjectCollection moc = mc.GetInstances();
                foreach (ManagementObject mo in moc)
                {
                    _S_RegsionGUID = mo.Properties["ProcessorId"].Value.ToString();
                    break;
                }
            }
            catch (Exception)
            {
                _S_RegsionGUID = Common.EnBase64(AppDomain.CurrentDomain.BaseDirectory);
            }
            finally {
                mc.Dispose();
            }
        }
阅读更多
个人分类: Asp.Net+SqlServer2005
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭