为什么我的应用程序只能在管理员上运行? [英] why my Application Can run on administrator only?

查看:106
本文介绍了为什么我的应用程序只能在管理员上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

如何修复我的应用程序以在任何用户(管理员,用户,每个人)上运行

请告诉我

谢谢您.

Hi all

how do i do to fix my application to run on any user (Admin, User, Every one)

please tell me

thank you

推荐答案

没有更多的信息,您必须首先跟踪您正在执行的需要提升特权的操作.例如,使用普通帐户以及调试器或堆栈跟踪信息运行您的应用程序,以找出失败的原因.
还可以查看以下主题: http://msdn.microsoft.com/zh-cn/library/bb756973.aspx [ ^ ].我认为,您应该了解UAC如何影响程序.
Without any more information you have to first track what you are doing that requires elevated privileges. For example run your app with normal account and with debugger or stack trace information find out what fails.

Also have a look at this topic: http://msdn.microsoft.com/en-us/library/bb756973.aspx[^]. In my opinion, you should learn how UAC affects programs.


您可能会或可能无法修复"它.解决办法是什么?通常,您可能会访问只有管理员才能访问的文件系统的一部分.无论您做什么,您的应用程序将继续需要管理员访问权限.但是,您只能使用一些合法"目录,我强烈建议您这样做-在没有管理员权限的情况下您将可以访问.但是我可能不会被认为是一种解决办法,而是一种行为上的改变,这可能是非常合理的.

考虑仅使用特殊目录",请参见System.Environment.GetFolderPath(Environment.SpecialFolder),请参见:
http://msdn.microsoft.com/en-us/library/system.environment.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.environment. specialfolder.aspx [ ^ ].

管理员权限可能有许多其他原因.一个问题是,您显然没有在堆栈或UI周期的顶部捕获所有异常,并且/或者没有提供足够的异常信息,否则您将知道确切的原因.
因此,还请阅读我对异常处理的建议,尤其是在UI中:
我如何制作滚动条到达底部时将停止的循环 [当我运行应用程序时,异常是捕获了如何处理? [ throw. .then ... rethrowing [ ^ ],
错误记录和屏幕截图. [捕获异常 [
You may or may not be able to "fix" it. What is the fix? Typically, you might access a part of file system where only an administrator can get access to. Whatever you do, your application will continue to require administrator access. However, you you can use some "legal" directories only, I would highly recommend you to do so — you will get access without administrator permissions. But I might not be considered as a fix, rather a change in behavior, which can be very reasonable.

Consider using "special directory" only, see System.Environment.GetFolderPath(Environment.SpecialFolder), see:
http://msdn.microsoft.com/en-us/library/system.environment.aspx[^],
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx[^].

There can be many other reasons for administrator permissions. One problem is that you apparently don''t catch all exceptions on top of the stack or UI cycle and/or don''t present sufficient exception information, otherwise you would know exact reason.

So, please also read my recommendation on exception handling, especially in UI:
How do i make a loop that will stop when a scrollbar reaches the bottom[^],
When i run an application an exception is caught how to handle this?[^],
throw . .then ... rethrowing[^],
Error Logging and Screen Shot.[^],
Catching an Exception[^].

Additionally (not alternatively, proper exception handling is a must!), you should know the exact reason of the problem from debugging, as Mika pointed out.

Good luck,
—SA


这篇关于为什么我的应用程序只能在管理员上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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