visual studio setup project windows service install error

Hamed Vaziri 136 Reputation points
2023-08-20T20:01:36.2733333+00:00

Hi

In my visual studio setup project, ive added a windows service (inside applicationFolder\Service directory) which want to install during installation process. to do this, i've created an installService.bat batch file which contains the following commands :

@echo off
sc create "Houshmand Configuration Manager Service" binpath= "%~dp0Service\Houshmand.ConfigManager.Service.exe" start= delayed-auto
net start "Houshmand Configuration Manager Service"

to run this commands, i've add cmd.exe from windows directory into my setup project aplicationFolder directory and in custom action add it in commit node, then set the following command in arguments :

/k "installService.bat"

but when i build and run my setup project, facing this message during installation service and when i close the message, my setup process being rolled back!!!

DNS server not authoritative for zone. Not enough memory resources are available to process this command.

But when i execute the given batch file (installService.bat) as administrator manually, it works correctly!!!

where is the problem and how to solve it?

Thanks in advance

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,449 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,151 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 48,391 Reputation points
    2023-08-21T15:37:37.15+00:00

    There is a sample Visual Studio Solution for a .Net Framework C# Windows Service that also includes Visual Studio Installer projects. Although the sample is old it can be updated and does not require you to write custom actions for a successful service install. The sample can be obtained from the msdn code gallery at https://github.com/microsoftarchive/msdn-code-gallery-microsoft/tree/master/OneCodeTeam/A%20basic%20Windows%20service%20in%20C%23%20(CSWindowsService)

    0 comments No comments

  2. Hamed Vaziri 136 Reputation points
    2023-08-21T16:31:43.6733333+00:00

    Hi again

    I've solved my problem which described in this link.

    Hope this useful.

    best regards

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.