I am using CodeDeplpy to deploy several IIS applications on a Windows 2019 server. During the deployment of one of my .Net Core 3.1 applications I noticed this error:
Permission denied # unlink_internal - C:/inetpub/wwwroot/webApi/AutocheckerEntities.dll
To solve that I added a line that kills the whole dotnet.exe process (see below) in addition to stopping the app pool and the app itself (see below). I added the dotnet kill line as simply stopping the app pool & app did not get around the error.
appstop.ps1:
Stop-WebSite 'WebApi'
Stop-WebAppPool (Get-Website -Name WebApi).applicationPool
taskkill /IM "dotnet.exe" /F
appspec.yml:
version: 0.0
os: windows
files:
- source: /
destination: C:\inetpub\wwwroot\webApi
hooks:
BeforeInstall:
- location: CodeDeploy/appstop.ps1
runas: administrator
ApplicationStart:
- location: CodeDeploy/appstart.ps1
runas: administrator
Is there a way to release temporarily the files in C:\inetpub\wwwroot\webApi directory without killing the whole dotnet.exe process? I have other dotnet applications on the same server and killing the process can affect those as well.
I'm working on a project for deploying pentest lab with terraform & ansible. All is working good except that last problem.
In my lab I have a nginx server running on a Windows server. Nginx with php works when I start them as Administrator with ansible but i need them to run with a non admin local account.
For the php i've made a wrapper using this tools : https://github.com/antonioCoco/RunasCs
But it doesn't work with nginx cause of a working directory problem :
Here is the error :
PS C:\Users\Administrator> .\RunAsCs.exe nginx ***** C:\Web\nginx-1.19.6\nginx.exe
[*] Warning: GetUserProfileDirectory failed with error code: 2
[*] Warning: Unable to obtain environment for user 'nginx'.
[*] Warning: Environment of created process might be incorrect.
nginx: [alert] could not open error log file: CreateFile() "logs/error.log" failed (3: The system cannot find the path specified)
2021/03/06 10:18:33 [emerg] 5556#6124: CreateFile() "C:\Windows\system32/conf/nginx.conf" failed (3: The system cannot find the path specified)
And that's normal because as you can see my wrapper start in Windows/System32
I would like to know if there is a solution either with nginx.conf or with ansible to start this exe as the "nginx" user.
This is a working code for starting nginx as Administrator
- name: Starting web server
win_shell: .\nginx.exe
args:
chdir: C:\Web\nginx-1.19.6
async: 180
poll: 0
I know that there is a psexec module in ansible but psexec will work only for Local Admin account and the goal of that is that my nginx don't run as Local Admin.
Thanks for the help !
I've already tried using System.Diagnostics.Debug.WriteLine as suggested here, but nothing is written to console when I put a WriteLine call at the top of my Startup.ConfigureServices method then run the ASP.NET application locally with dotnet run -c debug.
For other reasons I can't just use the ILogger interface (trying to debug logging some Application Insights initializers so can't get an ILogger instance).
Using .NET Core 3.1.201. Steps to reproduce:
Open console, move to empty directory and type dotnet new web
Open generated project, add System.Diagnostics.Debug.WriteLine("TEST TEST TEST"); to the Startup.ConfigureServices method
Open the appsettings.development.json file and set all log levels to Debug
Run dotnet run -c debug and view console output; there will be no TEST TEST TEST string present:
PS C:\Users\ahelwer\source\prototype\test> dotnet run -c debug
dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
Hosting starting
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[2]
Failed to locate the development https certificate at '(null)'.
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[0]
Using development certificate: CN=localhost (Thumbprint: 9C942CB86D28BD34EC038AC614E1D069646F30E7)
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
dbug: Microsoft.AspNetCore.Hosting.Diagnostics[0]
Loaded hosting startup assembly test
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Users\ahelwer\source\prototype\test
dbug: Microsoft.Extensions.Hosting.Internal.Host[2]
Hosting started
Contents of appsettings.development.json:
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft": "Debug",
"Microsoft.Hosting.Lifetime": "Debug"
}
}
}
I am trying to run automated coded UI/selenium tests on a virtual machine through VSTS. The test assemblies are successfully copied over to the virtual machine.
However, when I use the "Visual Studio Test Agent Deployment" task, I am receiving this series of errors:
2018-04-26T23:56:18.0956226Z testMachineInput = SIT-WEB.corp.com
2018-04-26T23:56:18.1112475Z adminUserName = AMR\abbie
2018-04-26T23:56:18.1112475Z winRmProtocal = Http
2018-04-26T23:56:18.1112475Z testCertificate = true
2018-04-26T23:56:18.1112475Z machineUserName =
2018-04-26T23:56:18.1112475Z runAsProcess = true
2018-04-26T23:56:18.1112475Z logonAutomatically = true
2018-04-26T23:56:18.1112475Z disableScreenSaver = true
2018-04-26T23:56:18.1112475Z isDataCollectionOnly = false
2018-04-26T23:56:18.1112475Z testPlatform = 15.0
2018-04-26T23:56:18.1112475Z agentLocation =
2018-04-26T23:56:18.1112475Z updateTestAgent = false
2018-04-26T23:56:18.1112475Z ****************************************************************
2018-04-26T23:56:18.6112524Z Starting to deploy and configure test agent on test machines.
2018-04-26T23:56:18.6112524Z Inputs provided are:
2018-04-26T23:56:18.6112524Z Use HTTP Port: True
2018-04-26T23:56:18.6112524Z Username: AMR\abbie
2018-04-26T23:56:18.6112524Z Disable Screen saver: True
2018-04-26T23:56:18.6112524Z Login Automatically: True
2018-04-26T23:56:18.6112524Z Run as process: True
2018-04-26T23:56:18.6112524Z Agent would be downloaded from https://go.microsoft.com/fwlink/?LinkId=615472
2018-04-26T23:56:18.6112524Z Update test agent: False
2018-04-26T23:56:18.6112524Z Run test agent as DataCollection only : False
2018-04-26T23:56:19.0643890Z Task 'VerifyTestAgentInstalled' on machine 'SIT-WEB.corp.com:5985' is being run
2018-04-26T23:56:22.7831688Z Task 'VerifyTestAgentInstalled' on machine 'SIT-WEB.amr.corp.com:5985' completed.
2018-04-26T23:56:22.7831688Z ##[warning]Task 'VerifyTestAgentInstalled' for machine SIT-WEB.com:5985's Error : System.AggregateException: Failed to start service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097'. Consult the logs below:
2018-04-26T23:56:22.7831688Z Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.
2018-04-26T23:56:22.7831688Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-04-26T23:56:22.7831688Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-04-26T23:56:22.7831688Z ---> System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.
2018-04-26T23:56:22.7831688Z --- End of inner exception stack trace ---
2018-04-26T23:56:22.7831688Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable) in E:\v2.0\A5\_work\1\s\DevTestLabs\Client\Deployment\Deployment\PowershellExecutor.cs:line 178
2018-04-26T23:56:22.7831688Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.StartService(String serviceName) in E:\v2.0\A5\_work\1\s\DevTestLabs\Client\Deployment\Deployment\RemoteDeploymentHelper.cs:line 97
2018-04-26T23:56:22.7831688Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.<RunAsync>d__24.MoveNext() in E:\v2.0\A5\_work\1\s\DevTestLabs\Client\Deployment\Deployment\DeploymentClient.cs:line 367
2018-04-26T23:56:22.7987958Z ---> (Inner Exception #0) System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.<---
2018-04-26T23:56:22.7987958Z
2018-04-26T23:56:22.7987958Z ##[warning]Task 'VerifyTestAgentInstalled' for machine SIT-WEB.corp.com:5985's Log : System.AggregateException: Failed to start service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097'. Consult the logs below:
2018-04-26T23:56:22.7987958Z Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.
2018-04-26T23:56:22.7987958Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-04-26T23:56:22.7987958Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-04-26T23:56:22.7987958Z ---> System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.
2018-04-26T23:56:22.7987958Z --- End of inner exception stack trace ---
2018-04-26T23:56:22.7987958Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable) in E:\v2.0\A5\_work\1\s\DevTestLabs\Client\Deployment\Deployment\PowershellExecutor.cs:line 178
2018-04-26T23:56:22.7987958Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.StartService(String serviceName) in E:\v2.0\A5\_work\1\s\DevTestLabs\Client\Deployment\Deployment\RemoteDeploymentHelper.cs:line 97
2018-04-26T23:56:22.7987958Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.<RunAsync>d__24.MoveNext() in E:\v2.0\A5\_work\1\s\DevTestLabs\Client\Deployment\Deployment\DeploymentClient.cs:line 367
2018-04-26T23:56:22.7987958Z ---> (Inner Exception #0) System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.<---
2018-04-26T23:56:22.7987958Z
2018-04-26T23:56:22.7987958Z ##[error]Error occurred on 'SIT-WEB.com:5985'. Details : 'Failed to start service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097'. Consult the logs below:
2018-04-26T23:56:22.7987958Z Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.
2018-04-26T23:56:22.7987958Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-04-26T23:56:22.7987958Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-04-26T23:56:22.7987958Z '. For troubleshooting, refer https://aka.ms/remotevstest.
2018-04-26T23:56:22.7987958Z Service 'VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 (VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployerd538408c-9353-4a01-9acc-e8df4acf2097 on computer '.'.
2018-04-26T23:56:22.7987958Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-04-26T23:56:22.7987958Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-04-26T23:56:22.7987958Z '. For troubleshooting, refer https://aka.ms/remotevstest.
2018-04-26T23:56:22.8769311Z ##[error]Exception calling "Start" with "1" argument(s): "Deploy Test Agent task has failed on all machines. Check the logs for more details."
2018-04-26T23:56:22.9081625Z ##[section]Finishing: Deploy TestAgent on
I realize that this is the deprecated series of test tasks, but we are having trouble actually getting the newer version to work with a hosted agent because UNC paths are not accepted as search folder options.
Update:
After downloading the test agent to my machine, I am getting a new set of errors:
Below are my build definitions as well as my new error log.
Copy definition/ Deploy Test Agent definition/ Run Test Definition
2018-05-10T17:01:30.1946693Z ##[section]Starting: Deploy TestAgent on SIT-WEB.com
2018-05-10T17:01:30.1960462Z ==============================================================================
2018-05-10T17:01:30.1960794Z Task : Visual Studio Test Agent Deployment
2018-05-10T17:01:30.1961001Z Description : Deploy and configure Test Agent to run tests on a set of machines
2018-05-10T17:01:30.1961202Z Version : 1.0.42
2018-05-10T17:01:30.1961369Z Author : Microsoft Corporation
2018-05-10T17:01:30.1961552Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=625976)
2018-05-10T17:01:30.1961751Z ==============================================================================
2018-05-10T17:01:30.2036732Z Preparing task execution handler.
2018-05-10T17:01:31.1771823Z Executing the powershell script: C:\Windows\SysWOW64\agent\_work\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6\1.0.42\DeployTestAgent.ps1
2018-05-10T17:01:33.3696416Z ##[error]Unable to process command '##vso[task.setvariable variable=DTA:cd7fb3c2-465a-40d0-9cae-b9fa87fc4215;issecret=true;]{"TestMachineProps":{"_machinePropertyMap":{"dta://env/Cut/_apis/3117/201805101001333378":"Microsoft-AgentsForVS"}},"TestUriDetails":{"_environmentMap":{"dta://env/Cut/_apis/3117/201805101001333378":"SIT-WEB.com"}},"TestDeploymentEnvDetails":{"_testEnvironmentMap":{"SIT-WEB.com":{"Id":0,"Url":null,"Revision":0,"Project":{"Id":"Cut","Name":"Cut"},"ModifiedBy":{"Name":"7e665146-2d3c-6194-8b85-fa4143db4342"},"Resources":[{"Id":1,"Name":"SIT-WEB.com","Properties": {%0D%0A "Microsoft-Vslabs-MG-Resource-FQDN": {%0D%0A "IsSecure": false,%0D%0A "Data": "SIT-WEB.com"%0D%0A },%0D%0A "WinRM_Http": {%0D%0A "IsSecure": false,%0D%0A "Data": "5985"%0D%0A }%0D%0A }%0D%0A }%0D%0A ],%0D%0A "Properties": {%0D%0A "Microsoft-Vslabs-MG-Resource-Username": {%0D%0A "IsSecure": false,%0D%0A "Data": "AMR\\abbiejon"%0D%0A },%0D%0A "Microsoft-Vslabs-MG-Resource-Password": {%0D%0A "IsSecure": true,%0D%0A "Data": "***"%0D%0A },%0D%0A "Microsoft-Vslabs-MG-WinRMProtocol": {%0D%0A "IsSecure": false,%0D%0A "Data": "HTTP"%0D%0A },%0D%0A "Microsoft-Vslabs-MG-SkipCACheck": {%0D%0A "IsSecure": false,%0D%0A "Data": "False"%0D%0A }%0D%0A },%0D%0A "Name": "SIT-WEB.com",%0D%0A "IsReserved": false,%0D%0A "CreatedBy": {%0D%0A "Name": "7e665146-2d3c-6194-8b85-fa4143db4342"%0D%0A },%0D%0A "CreatedDate": "2018-05-10T17:01:33.2753626Z",%0D%0A "ModifiedDate": "0001-01-01T00:00:00"%0D%0A }%0D%0A }%0D%0A }%0D%0A}' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
2018-05-10T17:01:33.3710621Z ##[error]Secrets cannot contain multiple lines
2018-05-10T17:01:33.8621018Z DistributedTests: Starting to deploy and configure test agent on test machines.
2018-05-10T17:01:33.8621317Z DistributedTests: Inputs provided are:
2018-05-10T17:01:33.8621502Z DistributedTests: Username: AMR\abbiejon
2018-05-10T17:01:33.8621986Z DistributedTests: Use HTTP Port: True
2018-05-10T17:01:33.8622157Z DistributedTests: Run as process: True
2018-05-10T17:01:33.8622342Z DistributedTests: Login Automatically: True
2018-05-10T17:01:33.8622514Z DistributedTests: Disable Screen saver: True
2018-05-10T17:01:33.8622716Z DistributedTests: Agent would be downloaded from https://go.microsoft.com/fwlink/?LinkId=615472
2018-05-10T17:01:33.8622924Z DistributedTests: Update test agent: False
2018-05-10T17:01:33.8623105Z DistributedTests: Run test agent as DataCollection only : False
2018-05-10T17:01:33.8623393Z DistributedTests: Path to script that installs test agent on remote machine: C:\Windows\SysWOW64\agent\_work\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6\1.0.42\TestAgentInstall.ps1
2018-05-10T17:01:33.8625199Z DistributedTests: Path to script that configures test agent on remote machine: C:\Windows\SysWOW64\agent\_work\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6\1.0.42\TestAgentConfiguration.ps1
2018-05-10T17:01:33.8625606Z DistributedTests: Path to script that downloads test agent on Azure remote machines : C:\Windows\SysWOW64\agent\_work\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6\1.0.42\DownloadTestAgent.ps1
2018-05-10T17:01:33.8625995Z DistributedTests: Path to script that checks if test agent is installed on remote machine: C:\Windows\SysWOW64\agent\_work\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6\1.0.42\CheckTestAgentInstallation.ps1
2018-05-10T17:01:33.8626400Z DistributedTests: Path to script that checks if test agent is already running on remote machine: C:\Windows\SysWOW64\agent\_work\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6\1.0.42\VerifyTestMachinesAreInUse.ps1
2018-05-10T17:01:33.8626713Z DistributedTests: Path to script that helps to download and configure test agent :
2018-05-10T17:01:33.8626951Z DistributedTests: Task 'PopulatingMachinesPresentState' on machine 'SIT-WEB.com:5985' is being run
2018-05-10T17:01:35.3156824Z DistributedTests: Task 'PopulatingMachinesPresentState' on machine 'SIT-WEB.com:5985' completed.
2018-05-10T17:01:35.3209546Z ##[warning]DistributedTests: Task 'PopulatingMachinesPresentState' for machine SIT-WEB.com:5985's Error : System.AggregateException: Failed to start service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff'. Consult the logs below:
2018-05-10T17:01:35.3210707Z Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.
2018-05-10T17:01:35.3213811Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-05-10T17:01:35.3214259Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-05-10T17:01:35.3214742Z ---> System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.
2018-05-10T17:01:35.3215153Z --- End of inner exception stack trace ---
2018-05-10T17:01:35.3215626Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable)
2018-05-10T17:01:35.3216024Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.StartService(String serviceName)
2018-05-10T17:01:35.3216698Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.<RunAsync>d__24.MoveNext()
2018-05-10T17:01:35.3218150Z ---> (Inner Exception #0) System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.<---
2018-05-10T17:01:35.3218472Z
2018-05-10T17:01:35.3219184Z ##[warning]DistributedTests: Task 'PopulatingMachinesPresentState' for machine SIT-WEB.com:5985's Log : System.AggregateException: Failed to start service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff'. Consult the logs below:
2018-05-10T17:01:35.3221150Z Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.
2018-05-10T17:01:35.3221658Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-05-10T17:01:35.3222157Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-05-10T17:01:35.3222701Z ---> System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.
2018-05-10T17:01:35.3223208Z --- End of inner exception stack trace ---
2018-05-10T17:01:35.3223659Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable)
2018-05-10T17:01:35.3224196Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.StartService(String serviceName)
2018-05-10T17:01:35.3224645Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.<RunAsync>d__24.MoveNext()
2018-05-10T17:01:35.3225206Z ---> (Inner Exception #0) System.Management.Automation.RemoteException: Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.<---
2018-05-10T17:01:35.3225684Z
2018-05-10T17:01:35.3226401Z ##[error]Error occurred on 'SIT-WEB.com:5985'. Details : 'Failed to start service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff'. Consult the logs below:
2018-05-10T17:01:35.3228948Z Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.
2018-05-10T17:01:35.3229455Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-05-10T17:01:35.3229893Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-05-10T17:01:35.3231484Z '. For troubleshooting, refer https://aka.ms/remotevstest.
2018-05-10T17:01:35.3240548Z ##[error]System.Exception: Error occurred on 'SIT-WEB.com:5985'. Details : 'Failed to start service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff'. Consult the logs below:
2018-05-10T17:01:35.3241695Z Service 'VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff (VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff)' cannot be started due to the following error: Cannot start service VisualStudioRemoteDeployer08bb67c0-170e-4bd9-9d07-094bbf5cacff on computer '.'.
2018-05-10T17:01:35.3242509Z CategoryInfo :OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
2018-05-10T17:01:35.3242924Z FullyQualifiedErrorId :CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
2018-05-10T17:01:35.3243296Z '. For troubleshooting, refer https://aka.ms/remotevstest.
2018-05-10T17:01:35.3728128Z DistributedTests: Update test agent is disabled. Skipping test agent updates.
2018-05-10T17:01:35.3773380Z ##[warning]For troubleshooting, refer https://aka.ms/remotevstest.
2018-05-10T17:01:35.3785766Z ##[error]System.InvalidOperationException: Deploy Test Agent task has failed on all machines. Check the logs for more details.
2018-05-10T17:01:35.3786705Z at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.DtlMachineDeploymentHelper.ThrowIfNumberOfTargetMachinesAreZero(String exceptionMessage)
2018-05-10T17:01:35.3787228Z at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.DtlMachineDeploymentHelper.ConfigureTestAgent(String username, String password, String collectionUrl, Boolean runAsProcess, Boolean disableScreenSaver, Boolean logonAutomatically, String environmentUrl, String configureTestAgentScriptPath, String personalAccessToken, String capabilities, List`1 machinesToBeExcluded, Boolean keepConnectionAlive)
2018-05-10T17:01:35.3787696Z at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.DeployTestAgent.Run()
2018-05-10T17:01:35.3787980Z at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.TaskRunner.Run(Dictionary`2 arguments, VssConnection connection, TaskType taskType)
2018-05-10T17:01:35.3788286Z at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.InvokeDeployTestAgentCmdlet.ProcessRecord()
2018-05-10T17:01:35.3978130Z ##[error]PowerShell script completed with 2 errors.
2018-05-10T17:01:35.3987644Z ##[section]Finishing: Deploy TestAgent on SIT-WEB.com
Any insight into what could be causing this error?
Thanks!
Task Deploy Visual Studio Test Agent Task requires:
.NET 4.6.1 on Windows7 or Windows 2K8R2
PowerShell 3 or newer
Test machines should have PSRemoting enabled (run 'Enable-PSRemoting'
on Windows Powershell)
You need to check whether your environment meets the requirement.
This could be a logon issue with the admin account running the VisualStudioRemoteDeployer service. This will be the same admin account provided in the PowerShell on Target Machines.
When running the PowerShell on Target Machines task it will connect to the remote machine and then proceed with setting up and starting VisualStudioRemoteDeployer as a temporary Windows service with the provided admin account in the PowerShell on Target Machines task before running the provided PowerShell script. So if it fails installing VisualStudioRemoteDeployer as a service, it will tell you that the service wasn't installed. But in your case the service is actually installed and the log is telling us "Failed to start service". This means that the service isn't starting and the Powershell on Target Machines will fail.
You can try to setup a random service on the remote machine with the admin account you provided in the PowerShell on Target Machines and try to start it. If this fails then there´s something wrong with the account you provided and you´re more likley to get a better error message from the services.msc than from PowerShell.
Two things you can check that has solved this issue for us when encountering this problem is to check:
Is the account allowed to log on as a service. Check this using
"Local Security Policy" and navigate to Local Policies -> User Rights
Assignment here you should check that the account you provided in the
PowerShell on Target Machines is a part of the "Log on as a service"
policy and also that your account isn´t a part of the "Deny log on as
a service" policy.
Is there something wrong with the admin account We´ve encounterd
problems with the account being member of over 1000 groups which
will make us pass the token size limit making the account unable
to logon then you´ll get the "Failed to start service" message on
the PowerShell on Target Machines task. Resolve this by removing
membership in all unnecessary groups. Read more about max token size
here
https://blogs.technet.microsoft.com/shanecothran/2010/07/16/maxtokensize-and-kerberos-token-bloat/
Hope this helps, might not be the problem in your case but this is how we fixed our problems with "Failed to start service" with the PowerShell on Target Machines task.
I have applications:
1. Client-side which is Angular 2+/ASP.NET Core project
2. Server-side ASP.NET Core Web Api with MS SQL database (Entity Framework Core)
This apps have configured CORS.
How can I publish both of this apps on Heroku?
I started with the server-side using this tutorial
https://blog.devcenter.co/deploy-asp-net-core-2-0-apps-on-heroku-eea8efd918b6
But after this step:
docker build -t <image-name> ./bin/release/netcoreapp2.0/publish
I have tried to run this docker image and it doesn't work correctly:
docker run --rm -it -p 8080:8080 treeder/myapp
The app failed. There is some problem with connection to MSSQL...
An error occurred using the connection to database 'sample-app' on
server 'localhost'. System.Data.SqlClient.SqlException (0x80131904): A
network-related or instance-specific error occurred while establishing
a connection to SQL Server. The server was not found or was not
accessible. Verify thatthe instance name is correct and that SQL
Server is configured to allow remote connections. (provider: TCP
Provider, error: 35 - An internal exception was caught) --->
System.AggregateException: One or more errors occurred. (Connection
refused 127.0.0.1:1433) --->
System.Net.Internals.SocketExceptionFactory+ExtendedSocketException:
Connection refused 127.0.0.1:1433
Even command used to login to Heroku Containter Registry doesn't work:
$ heroku container:login
And it gives me such an error:
heroku container:login unknown flag: --password-stdin See 'docker
login --help'. ▸ Error: docker login exited with 125
There could be number of problems.
Asp.net core looks for ASPNETCORE_ENVIRONMENT environment variable to determine type of deployment. If value for the variable is not found, then it will assume that it is running in production environment.
Check you have put your connection string in appsettings.Development.json. Since we are not setting value for the variable when running the image, it is not reading the development setting file.
If you are using localhost for SQL server, then application will try to connect to the SQL server on the port inside container. But SQL server is running on the host and not in the container. You can ask Docker to attach container to host machine.
Also if you are using exact instructions in the article, then you will need to pass it the port number. Try the command below and see if that works.
docker build -t treeder/myapp ./bin/release/netcoreapp2.0/publish
docker run --rm -it --expose=8080 -p 8080:8080 -e="PORT=8080" -e="ASPNETCORE_ENVIRONMENT=Development" --network="host" treeder/myapp