System.Security.SecurityException:The source is not found, but the some or all event logs could isn't be searched. Inaccessible logs:security.

Source: Internet
Author: User

How to install and uninstall Windows services using InstallUtil Visual Studio version

For an article about installing and uninstalling Windows Services using InstallUtil in Visual Studio 2012, http://msdn.microsoft.com/en-us/library/in MSDN Sd8zc8ha.aspx has introduced, but this introduction still has some general, the specific operation is not strong, the following gives detailed operation method:

  1. Click on the Start button in the lower left corner, in the following orderStartVisual Studio 2012-Visual Studio Tools-Developer Command Prompt for VS2012 , open a command window (do not use the traditional cmd mode to open the normal DOS window)
  2. In this command window to run as administrator, the specific command is: Runas/user:Administrator cmd Note where Administrator is the specific user name, If your current user name is an administrator, but the user name is myname, replace it with MyName administrator
  3. After the command executes, prompt for the password of the user name, input as required (at this point the interface is similar to Linux, the password entered does not show any)
  4. After the password is entered correctly, a new CMD window is opened, and the title is cmd (run as MyName)
  5. Enter the created Service application directory (typically under Bin\Debug) and enter the command: Installutil.exe Myservice.exe If the installation is successful, the command prompt is displayed directly without any information, and if the installation is unsuccessful, The message will appear (the installation is not successful under discussion below);
  6. Right-click on "My Computer-admin-(left column) services and applications-services", you can find the service "MyService", the service is just installed, and does not start, double-click the service to open the Properties window, click Start to

The above is all smooth under the circumstances of the installation steps, but in fact, few people can be installed successfully, the author is also half a day to install success.

The frequently-occurring problems with installation failures are:

1. InstallUtil.exe is not found, this file is under the framework directory of the. NET installation file directory, because it is a Windows service made using VS2012, it is recommended to use InstallUtil.exe under V4.0.xxxxxx to copy this file directly to the service file directory, it is convenient to use the cmd window (note: The lower version of the InstallUtil.exe, such as the V2.0.xxxxxx directory under the same name file, in the trial can also be installed and uninstalled);

2, InstallUtil.exe can run alone, that is, without parameters can be run and display the corresponding operation help, but if the command after the installation with the service application name, that is, when using the Installutil.exe Myservice.exe command, the installation fails, One of the failure messages is:

An exception occurred during the Install phase.

System.Security.SecurityException:The source is not found, but the some or all event logs could isn't be searched. inaccessible logs:security.

This information can be seen in the cmd window, or you can see it in the Installutil.installlog log file in the service directory (open it with Notepad), and you can see that the source file cannot be accessed for security reasons.

The substantive issue remains insufficient authority. Although we opened the VS2012 cmd window as an administrator, the file InstallUtil and the service file MyService not run as an administrator. The workaround is to right click on the InstallUtil.exe file in the Explorer, click Properties, in the "Compatibility" tab of the Open Properties window, tick "Run this program as administrator" under the privilege level, and use the same method to operate the service file MyService. Complete the above work and re-perform the 5th step of the above steps, which is the installation success.

To uninstall the Windows service, use the/u parameter. The command is:

Installutil/u Myservice.exe

System.Security.SecurityException:The source is not found, but the some or all event logs could isn't be searched. Inaccessible logs:security.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.