Dependency in a Windows service means a relationship between one service and another. This indicates that a service cannot run on its own without the support of other services. This concept resembles daemons in Unix, where programs run in the background to complete specific tasks.
Dependency is critical in Windows services to ensure that complex services can operate properly. Without the correct dependencies, the service can fail to start or stop suddenly, which can affect the stability and performance of the system. In addition, dependencies allow users to use remote procedure calls (RPCs) to manage services remotely through the Microsoft Management Console (MMC).
Some applications provide a simple example of dependency on a service. For example, the SQL Server service requires the Net Framework to execute SQL commands. If the Net Framework is down, SQL Server cannot function properly. Likewise, the IIS Web Server service requires ASP.NET to run web applications. Without active ASP.NET, IIS cannot provide web services optimally.
This dependency has a significant impact on the stability and performance of the system. One of the problems that may arise is a service that cannot be started if the service it needs is not active, which can interfere with the operating system and related applications.

In addition, error 1068 often appears, indicating that the dependent service is unable to operate due to the unavailability of another service. System performance can also be affected if the required services are slow or inefficient, which can slow down response and reduce productivity. Therefore, it is important to understand and manage these dependencies so that the system can function properly.
Why Add Dependency After Installation?
Adding dependencies after installation is a common practice in software development and system management. Here are some of the more in-depth reasons why this is done:
1. Changes in System Requirements
After the initial installation, the system needs may change as the application evolves. For example, if the app was originally designed for basic functionality, but then needs to add new features such as data analysis or integration with external APIs, then new dependencies may be required. This ensures that the app can adapt to the changing needs of users and the market.
2. Service Updates
Technology and software services continue to evolve. Updates to existing services, such as databases or frameworks, often introduce new features that cannot be accessed without adding new dependencies. For example, if a web framework is updated to support real-time data processing, then additional libraries or modules may be required to make the most of those features.
Adding the right dependencies can significantly improve the performance of the app. In a complex environment, where various services interact with each other, ensuring that all the necessary components are available and well integrated is essential. For example, adding a caching layer or queue system can help reduce the load on the server and improve the responsiveness of the application.
4. Compliance with Security Policies
Security is a very important aspect of software development. Sometimes, changes in security policies or regulations can force developers to add new dependencies. For example, if there is a requirement for stronger data encryption, then a new encryption library may need to be added to meet the standard. This also includes the addition of monitoring or auditing tools to ensure that the app remains secure and compliant with applicable regulations.
5. Integration with New Technologies
As technology advances, there is often a need to integrate applications with new technologies, such as cloud services, microservices, or analytics tools. The addition of new dependencies allows applications to communicate and function well within the broader technology ecosystem. For example, if an application wants to take advantage of machine learning services, then the relevant libraries or SDKs need to be added.
How to Add Dependencies to Windows Services
1. Using the Registry Editor
Here are the steps to add a dependency through the Registry Editor:

- Open the Registry Editor by pressing Win + R to open the Run dialog.
- Type regedit and press Enter.
- Navigate to Service Location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<Service_Name>- Replace <Service_Name> with the name of the service you want to add a dependency to.
- In the right pane, look for an entry named DependOnService. If there is none, create a new entry by right-clicking on the empty area and selecting New > Multi-String Value.
- Name the value DependOnService.
- Double-click on the DependOnService value you just created to edit the value.
- Enter the name of the service that is the dependency. If there is more than one service, make sure that each service name is written on a new line.
2. Using the Command Prompt:
You can add dependencies to Windows Services via the Command Prompt. Here are the steps:
- Right-click on the Command Prompt icon and select Run as administrator to open the Command Prompt with the required permissions.
- Type the following command in the Command Prompt:
sc config <Service_Name> depend= <Dependency_Name>- Replace <Service_Name> with the name of the service you want to add a dependency to, and <Dependency_Name> with the name of the service you want to add a dependency to.
Usage Examples
For example, if you want to add Tcpip and Afd as dependencies for a service named MyService, you would type the following command:
sc config MyService depend= Tcpip/AfdImportant Notes
Make sure there is a space after the equals sign (=) in the command.
Adding a new dependency will overwrite the existing list of dependencies. So, if MyService previously had another service as a dependency, after running this command, only Tcpip and Afd will be the new dependencies.
To see a list of existing dependencies, use the command:
sc qc <Service_Name>By following these steps, you can easily add dependencies to Windows Services using the Command Prompt.
3. Restart the Service to Apply Changes:
After adding dependencies to a Windows service, the next step is to restart the service for the changes to take effect. Here are two ways to restart the service:
Using the Command Prompt
You can use the net stop and net start commands to restart the service through the Command Prompt.
Steps:
- Open the Command Prompt with administrator privileges.
- Type the following command to stop the service:
net stop <Service_Name>Replace <Service_Name> with the name of the service you want to discontinue.
- After the service is stopped, type the following command to restart the service:
net start <Service_Name>Using Services Manager
You can also restart the service through the Services Manager.
Steps:
1. Press Win + R to open the Run dialog.
2. Type services.msc and press Enter.
3. Find the service you want to restart in the list.
4. Right-click on the service name and select Restart.
Make sure all required dependencies are active before restarting the main service.
Restarting the service will apply all the changes that have been made, including the addition of new dependencies so that the service can function properly according to the latest settings.

