Fix: Windows service hosting WCF service is not starting

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

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

  1. Press Windows Key + R to open Run.
  2. Type control and click OK to open the Control Panel.
  3. From the Control Panel, go to Program > Programs and Features.
  4. From the left pane, click on Turn Windows Features On or Off.
  5. Check the “Net Framework 3.5” option. After that, enable the following option depending on the use.
    Windows service hosting WCF service is not starting
    For Web HTTP – Enable “Windows Communication Foundation HTTP Activation” option.
    For TCP, MSMQ – Enable “Windows Communication Foundation NonHTTP Activation” option.
  6. Click OK to save the changes.
  7. Reboot the computer and check if the error is resolved.

How to enable Remote Desktop on Windows Server 2019


2. Register Network Service User

  1. 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.
  2. Type cmd in the search bar.
  3. Right-click on Command Prompt and select “Run as Administrator“.
    Windows service hosting WCF service is not starting
  4. In the Command Prompt window type, the following command and press enter.
    netsh http add urlacl url=http://+:8000/ user=”NETWORK SERVICE”
  5. It should give a success message.
  6. Check again if the Windows service is started and working again.
  7. If the issue persists, use the following command in the command Prompt.
    netsh http add urlacl url=http://+:8000/ sddl=”O:NS”
  8. Both the commands do a similar task, so try whichever works for you.

3. Check your Code Function for Error

  1. Most of the time the Windows service hosting WCF service is not starting is the result of users own mistake in the function code.
  2. 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.

Conclusion

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:

More about the topics: windows 10