[英]Run one of the projects in a solution as administrator in Visual Studio 2012
I've a Visual Studio 2012 solution that consists of two projects: MVC Web App and Windows Application. 我有一个Visual Studio 2012解决方案,其中包括两个项目:MVC Web App和Windows Application。
In the MVC Web App, users create some scheduler tasks, which are added to a database table. 在MVC Web App中,用户创建一些计划程序任务,这些任务将添加到数据库表中。 Because of security, I cannot run it as administrator (right-click VS 2012 and run as administrator).
由于安全原因,我无法以管理员身份运行它(右键单击VS 2012并以管理员身份运行)。
In order to create the scheduler tasks in the Windows Task Scheduler, I created a second project (Windows Application) in the same solution. 为了在Windows Task Scheduler中创建计划程序任务,我在相同的解决方案中创建了另一个项目(Windows应用程序)。 This app will create/update/delete scheduler tasks in the Windows Task Scheduler by getting the data from the MVC Web App.
此应用程序将通过从MVC Web应用程序获取数据来在Windows任务计划程序中创建/更新/删除计划程序任务。
Is there a way to run the second project, instead of the entire solution, as administrator? 有没有办法以管理员身份运行第二个项目而不是整个解决方案? Or do I have to create the Windows Application or Windows Service in a separate solution?
还是我必须在单独的解决方案中创建Windows应用程序或Windows服务? If so, what would be the best way to detect changes in the database table?
如果是这样,检测数据库表中更改的最佳方法是什么? SqlDependency, Change Data Capture, or something else?
SqlDependency,更改数据捕获或其他?
Thanks for any pointers. 感谢您的指导。
You need to add what is called an AppManifest to the project. 您需要在项目中添加所谓的AppManifest。 You can do this by right clicking on the project and selecting the "Add New Item" option.
您可以通过右键单击项目并选择“添加新项”选项来执行此操作。 Once the pop up arrives, select the "Application Manifest File".
弹出窗口到达后,选择“应用程序清单文件”。
Once this had been added to the project you need to adjust it to have the following line 将其添加到项目后,您需要对其进行调整以使其具有以下行
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.