Confusion about windows service/wcf install RRS feed

  • Question

  • I created a wcf service and in the same project created a windows service to host the wcf service. I then added an installer for the windows service and set the properties. Now begins the confusion...

    I installed the windows service using the cmd line and it installed correctly (but does not run due to access denied). The service is set to use the LocalService account. The wcf app connects to sql server (on network) to move data.


    When I installed the window service I didn't do anything with the wcf dll. Doesn't it have to be registered on the machine also? And how does the windows service know where to find it (is it based on the service reference I added to the windows service project?) Does that work when the dll is moved elsewhere?

    I think the windows service needs to run as administrator. Is that possible?



    Mike Rutledge

    Thursday, November 14, 2013 4:18 PM


  • If you added a reference in visual studio via add reference, the following directories will be searched (search order can vary slightly):

    Directory where the application is loaded from, system directory, 16-bit system directory, windows directory, directories listed in the PATH environment variable.

    If you explicitly want to load an assembly from a specific location, you could use the Assembly.LoadFile(...) method in code.

    In other words, if you install the wcf.dll in the same directory as your windows service, it should work.

    As for your second question, yes, it is possible to run the service as administrator.

    In the application manfest you can set a requested execution level of "requireAdministrator". For more information, have a look at this link: http://msdn.microsoft.com/en-us/library/bb756929.aspx

    • Marked as answer by Jason Dot Wang Friday, November 15, 2013 6:20 AM
    Thursday, November 14, 2013 10:31 PM