简体   繁体   English

在没有管理员权限的情况下运行WinForms应用程序?

[英]Run WinForms application without administrator rights?

I have created a windows forms application does some function. 我创建了一个Windows窗体应用程序,该程序具有某些功能。 The problem is when I deploy the application: 问题是当我部署应用程序时:

  1. If i deploy with ClickOnce then everything works fine. 如果我使用ClickOnce进行部署,则一切正常。 After installation the winforms application runs without asking for admin password. 安装后,winforms应用程序将运行,而无需输入管理员密码。
  2. If i deploy with Visual Studio Setup Project and create a MSI setup then after installing it requires administrator password every time it runs. 如果我使用Visual Studio安装程序项目进行部署并创建MSI安装程序,则在安装后每次运行时都需要管理员密码。

I want to deploy using Visual Studio Setup Project(MSI) , but don't want the software asking for elevated privileges. 我想使用Visual Studio安装项目(MSI)进行部署,但不希望该软件要求提升的特权。

The MSI installation does not ask for a password but the installed program does. MSI安装程序不要求输入密码,但已安装的程序要求输入密码。

you need to work with 您需要与

UAC elevated permission UAC提升权限

. take a look at this Ms Documentation link 看看这个Ms Documentation 链接

Also this project doing some R&D with UAC example 另外这个项目做了一些R&d与UAC 例子

Hope this Helps 希望这可以帮助

Basically you need to edit (or add, if you don't have one yet) an app.manifest file, then use the requestedExecutionLevel to order what is the execution context required. 基本上,您需要编辑(或添加,如果还没有的话)一个app.manifest文件,然后使用requestedExecutionLevel来排序所需的执行上下文。

Read more about it in MSDN MSDN中阅读有关它的更多信息

You'll need to create and embed an application manifest (UAC) in your application, as described here . 你需要创建并嵌入在应用程序中的应用程序清单(UAC),如所描述这里 If you don't want to do that, ClickOnce might be a solution. 如果您不想这样做,可以使用ClickOnce。

MSDN has some useful information on this topic, specifically: MSDN具有有关此主题的一些有用信息 ,特别是:

Impact to the user's computer. 对用户计算机的影响。 With Windows Installer deployment, applications often rely on shared components, with the potential for versioning conflicts; 在Windows Installer部署中,应用程序通常依赖于共享组件,从而可能导致版本冲突。 with ClickOnce deployment, each application is self-contained and cannot interfere with other applications. 使用ClickOnce部署,每个应用程序都是独立的,不会干扰其他应用程序。

Security permissions. 安全权限。 Windows Installer deployment requires administrative permissions and allows only limited user installation; Windows Installer部署需要管理权限,并且仅允许有限的用户安装。 ClickOnce deployment enables non-administrative users to install and grants only those Code Access Security permissions necessary for the application. ClickOnce部署使非管理用户可以安装并仅授予应用程序必需的那些代码访问安全性权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有办法以管理员权限运行UWP应用程序? - Is there Any way to Run UWP Application with Administrator Rights? 安装没有管理员权限的 WinForms 应用程序 - Install WinForms application without admin rights Visual Studio 安装项目:在没有管理员权限的情况下运行 msi 安装程序 - Visual Studio Setup Project: Run the msi installer without administrator rights 在运行时授予管理员权限 - Granting Administrator Rights During Run-Time 当应用程序以管理员身份运行时,是否可以在打开第二个表单时要求用户权限? - Is it possible to require user rights when opening second form ,when application run as administrator? WPF 应用程序 - 在运行时请求管理员权限 - WPF application - ask for administrator rights in runtime 没有管理员权限的VSTO插件和运行时 - VSTO addin and runtime without administrator rights 如何在Visual Studio 2022中创建C#应用程序安装程序,无需管理员权限即可安装? - How to create C# application installer in Visual Studio 2022, which can be installed without administrator rights? 在没有管理员权限的情况下终止父进程 - Kill parent process without administrator rights ABCpdf AddImageHtml文本拉伸没有管理员权限 - ABCpdf AddImageHtml text stretches without administrator rights
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM