Windows service installed with Procrun works in //TS mode, but doesn't start as a Windows service saying it "starte
By : Leandro Brito
Date : March 29 2020, 07:55 AM
Hope this helps Don't use any white-space in the service name! After many hours of testing and pulling apart Tomcat and duplicating it's bootstrap process, the fix for my problem ended up being that Apache Commons Daemon (Procrun) does not work properly when there is white-space in the name of the Windows service. code :
> prunsrv.exe //IS//MyService --Install="C:\path-to-prunsrv.exe" --Jvm=auto \
--Startup=auto --StartMode=jvm --Classpath="C:\path-to-MyService.jar" \
--StartClass=com.mydomain.MyService --DisplayName="My Service"
|
Windows service start failure: Cannot start service from the command line or debugger
By : goldcome
Date : March 29 2020, 07:55 AM
this will help Watch this video, I had the same question. He shows you how to debug the service as well. Here are his instructions using the basic C# Windows Service template in Visual Studio 2010/2012. code :
public void onDebug()
{
OnStart(null);
}
static void Main()
{
#if DEBUG
//While debugging this section is used.
Service1 myService = new Service1();
myService.onDebug();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#else
//In Release this section is used. This is the "normal" way.
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1()
};
ServiceBase.Run(ServicesToRun);
#endif
}
|
Windows Service won't start 'Error 1053: The service did not respond to the start or control request in timely fashion'
By : Laila
Date : March 29 2020, 07:55 AM
Does that help In my windows service, I added a console application project and made that the default startup project. I use this to debug the same code base the windows service starts. I have the working code in a separate class library project. My windows service project only has a service.cs file, projectinstaller.cs and the app.config files that I've duplicated to my console application. I'm not using any compiler directives to run different sets of code. code :
#######################
# Run as Administrator
#######################
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
#"No Administrative rights, it will display a popup window asking user for Admin rights"
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments
break
}
cls
#############################################################
# Set environment variables for Visual Studio Command Prompt
#############################################################
function Set-VsCmd
{
param(
[parameter(Mandatory, HelpMessage="Enter VS version as 2010, 2012, or 2013")]
[ValidateSet(2010,2012,2013)]
[int]$version
)
$VS_VERSION = @{ 2010 = "10.0"; 2012 = "11.0"; 2013 = "12.0" }
$targetDir = "c:\Program Files (x86)\Microsoft Visual Studio $($VS_VERSION[$version])\VC"
if (!(Test-Path (Join-Path $targetDir "vcvarsall.bat"))) {
"Error: Visual Studio $version not installed"
return
}
pushd $targetDir
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "(.*?)=(.*)") {
Set-Item -force -path "ENV:\$($matches[1])" -value "$($matches[2])"
}
}
popd
write-host "`nVisual Studio $version Command Prompt variables set." -ForegroundColor Yellow
}
Set-VsCmd 2013
#######################
# Stop windows service
#######################
$srvName = "Enterprise CQRS Service"
$serviceStop = Get-Service $srvName
"$srvName is now " + $serviceStop.status
Stop-Service $srvName
$TestService = Get-Service $srvName | Select-Object 'Status'
While($TestService | where {$_.Status -eq 'Running'}) {
Write-Host '.'-NoNewLine
Sleep 2
}
Write-Host "$srvName is now" $TestService.status -ForegroundColor Yellow
#################################
# Build Service as Debug - Local
#################################
# Set the solution file path
$scriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$solutionFile = Join-Path $scriptPath "../src/Enterprise CQRS Service.sln"
# Build the Debug - Local configuration
msbuild $solutionFile /p:Configuration='Debug - Local'
##############################
# Uninstall & Instal Service
##############################
# Set the exe file path
$exePath = Join-Path $scriptPath "../src/Enterprise.Services.Windows/bin/Debug - Local/Enterprise.Services.Windows.exe"
# Uninstall the service
installutil /u $exePath
# Install the service
installutil $exePath
# Start the service
$servicePrior = Get-Service $srvName
"$srvName is now " + $servicePrior.status
Start-Service $srvName
$serviceAfter = Get-Service $srvName
$foregroundColor = "Green"
if($serviceAfter.status -ne "Running")
{
$foregroundColor = "Red"
}
Write-Host "$srvName is now" $serviceAfter.status -ForegroundColor $foregroundColor
|
windows service - start service using batch file using task scheduler on windows 2012 server R2
By : Swapnil Patil
Date : March 29 2020, 07:55 AM
around this issue On my 2012 R2 server, I attempted to reproduce the problem you describe. The batch file always starts the service when I run via a scheduled task and I never get a cmd pop up. Your question did not specify scheduled task settings. You may need to enable the "Run with highest privileges" option on the General tab of your scheduled task. code :
cmd /c C:\startservice.bat
|
Windows, Start service System.InvalidOperationException: Cannot start service on computer '.' Access in Denied(Running a
By : loledeck
Date : March 29 2020, 07:55 AM
this one helps. There is a whole thread about it in social msdn. The issue persisted for numerous users and it seems you do not have enough privileges to start the service, in which case you will have to change the service into Administrative account: make sure that the service is set to Local Account by:
|