简体   繁体   中英

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.

In the MVC Web App, users create some scheduler tasks, which are added to a database table. Because of security, I cannot run it as administrator (right-click VS 2012 and run as administrator).

In order to create the scheduler tasks in the Windows Task Scheduler, I created a second project (Windows Application) in the same solution. This app will create/update/delete scheduler tasks in the Windows Task Scheduler by getting the data from the MVC Web App.

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? If so, what would be the best way to detect changes in the database table? SqlDependency, Change Data Capture, or something else?

Thanks for any pointers.

You need to add what is called an AppManifest to the project. 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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM