Windows Communication Foundation (WCF) is an essential part of any self-hosted server for Windows machine as it offers a framework for building service-oriented applications. At times after building a WCF project and installing the service you may encounter issues such as “Windows service hosting WCF service is not starting”.
The issue can occur due to several reasons including port error, disabled .Net Framework options and more. In this article, we take a look at the possible solutions to help you diagnose and resolve the Windows service hosting WCF service is not starting issue in Windows.
How to fix Windows service hosting WCF service is not starting
1. Enable .NET Framework Features
- Press Windows Key + R to open Run.
- Type control and click OK to open the Control Panel.
- From the Control Panel, go to Program > Programs and Features.
- From the left pane, click on Turn Windows Features On or Off.
- Check the “Net Framework 3.5” option. After that, enable the following option depending on the use.
For Web HTTP – Enable “Windows Communication Foundation HTTP Activation” option.
For TCP, MSMQ – Enable “Windows Communication Foundation NonHTTP Activation” option.
- Click OK to save the changes.
- Reboot the computer and check if the error is resolved.
2. Register Network Service User
- After creating the Windows Service, you need to register the Network Service user to listen on http port 8000 first. You can do this with the help of the following command.
- Type cmd in the search bar.
- Right-click on Command Prompt and select “Run as Administrator“.
- In the Command Prompt window type, the following command and press enter.
netsh http add urlacl url=http://+:8000/ user=”NETWORK SERVICE”
- It should give a success message.
- Check again if the Windows service is started and working again.
- If the issue persists, use the following command in the command Prompt.
netsh http add urlacl url=http://+:8000/ sddl=”O:NS”
- Both the commands do a similar task, so try whichever works for you.
3. Check your Code Function for Error
- Most of the time the Windows service hosting WCF service is not starting is the result of users own mistake in the function code.
- For example, any issues in the OnStart function can affect the working of WCF service. Make sure you check the service for any not so obvious error and then try to restart the service again.
By following the steps in this article you can resolve Windows service hosting WCF service is not starting issue in Windows computer. Do note that the solutions vary depending on the individual user problem unless the issue is with the WCF or Windows features itself.
RELATED STORIES YOU MAY LIKE:
- 8 scanner software to speed up your paperwork today
- How to enable Remote Desktop on Windows Server 2019
- How to recover Guest account on Windows 10 [QUICK GUIDE]