WebDeploy runcommand issue - webdeploy

I'm trying to deploy a package with WebDeploy V3.
The installation process is to sync between a source folder to a destination folder on the remote computer and run a certain powershell script after the sync is done.
The command being executed is:
'"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:dirPath='C:\source' -dest:dirPath='D:\destination',computerName=XXX -postSync:runcommand='powershell -inputformat none D:\destination\Install.ps1',successReturnCodes=0'
This yields the following error:
Info: Using ID '49edd786-d8a0-4acf-be7b-95dd6e1391cc' for connections to the remote server. Performing '-postSync'... Info:
Using ID '5ef9d005-82fa-4811-9f51-1741c8d622de' for connections to the remote server.
Info: Adding MSDeploy.runCommand (MSDeploy.runCommand).
Error: (11/28/2012 4:34:24 AM) An error occurred when the request was processed on the remote computer. Error: The entry type 'Unknown' was not expected at this time. The serialization stream may be corrupted.
Error count: 1.
Error during '-postSync'. Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes copied)
Searching the net for this error, I didn't see anybody who encountered it when using runcommand provider. If anybody encountered a similar issue and has ideas or suggestions I would be most thankful..

From what I've seen, using runCommand to execute an arbitrary command line might be a bit buggy. Try moving the commandline into a bat or cmd file and providing a (full?) path to that. The file will be uploaded and executed, as long as you don't try to pass in any arguments to it.

For future viewers of this post: I encountered this same specific error (Error: The entry type 'Unknown' was not expected at this time. The serialization stream may be corrupted) after adding runCommand provider usage to my MyProject.wpp.targets file for the Web Publishing Pipeline MSBuild process. The path was direct cmd shell input used in order to clear readonly flags with attrib -R.
In my case, my build server was configured with WebDeploy 3.0, while the server targeted by the deployment package was configured with Webdeploy 2.0. After upgrading the target server to Webdeploy 3.0 this particular problem was resolved.
However due to other errors surrounding runCommand (providing the correct path to the destination executable at package runtime) my solution still doesn't work entirely so take this all with a grain of salt.

Related

dll grpc_csharp_ext.x64.dll in use when deploying with msdeploy

I'm using msdeploy on gitlab with this args:
[string[]]$msdeployArgs = #(
"-source:package='$packageFile',IncludeAcls='False'",
"-dest:auto,ComputerName='https://$($server):8172/MsDeploy.axd?site=$($iisWebsite)',UserName='$($deployUsr)',Password='$($deployUsrPwd)',IncludeAcls='False',AuthType='Basic'",
"-verb=sync",
"-disableLink:AppPoolExtension",
"-disableLink:ContentExtension",
"-disableLink:CertificateExtension",
"-allowUntrusted",
"-retryAttempts=2",
"-enableRule:AppOffline",
"-setParam:name=""IIS Web Application Name"",value=""$iisApplicationName"""
)
and I have always an error:
Info: Using ID '41f89bfc-34bd-41c2-a820-ad75f7966651' for connections to the remote server.
Info: Adding ACLs for path (test)
Info: Adding ACLs for path (test)
Info: Adding ACLs for path (test/App_Data)
Info: Using ID '33b1c88c-c667-44b0-9b2e-ffeedf0a3e0f' for connections to the remote server.
Info: Updating file (tes\App_Data\Anonymous.xml).
Info: Updating file (test\Areas\Web.config).
Info: Updating file (test\bin\grpc_csharp_ext.x64.dll).
Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'grpc_csharp_ext.x64.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.
Error count: 1.
msdeploy errorCode: -1
how can i please ignore this error or force to deploy ??
Regards
grpc_csharp_ext.x64.dll is locked by IIS, so here are your options:
Restart IIS on the remote server before deploying (you can create a script to automate this process, Jenkins can also come to aid here)
If you have this issue locally, when building your project in Visual Studio - the easiest option would be to add iisreset /stop at pre-build
event, and iisreset /start at the post-build event, see here: Visual Studio 2013.2 can't build because IIS is locking an assembly)
Downgrade grpc to version 2.25.0 (or below), as this issue related to version 2.26.0 and up
Upgrade grpc to version 2.30.0, as this version implemented SkipGrpcNativeLibsCopying in Grpc.Core.targets file to resolve this issue. see more detail here: https://github.com/grpc/grpc/issues/21867 and here https://github.com/grpc/grpc/pull/22894, but be aware of the warning mentioned here: https://github.com/grpc/grpc/pull/22894/commits/c6723399b8d7ed580e72220b7d880f57d1d5eae9

ASP.NET 5 site fails to publish to azure appservice because of a long path

I'm trying to publish a relatively new ASP.NET site to azure appservice from Visual Studio.
I'm getting the following error message during the preview:
The "Dnu" task failed unexpectedly.
System.Exception:
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
Copying to output path C:\Users*****\AppData\Local\Temp\PublishTemp*****************.********.WebApi114
Error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at Microsoft.DNX.Tasks.Dnu.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
Path is long indeed. How do I fix it?
Error is from windows file API, not control by Azure App Service. Sadly I think you will have to find a way to shorter your file path in order to fix this issue.
I was running into the same issue trying to build an Angular2 app locally. So I tend to agree with Xiaomin that it may be a local issue. What worked for me was to run the dnu publish command from a command prompt with the output flag set with a shorter folder destination provided. For example, navigate to the location of the project you want to publish in a command prompt and type:
"dnu publish --runtime active -o c:\Sample"
The above command will post your output to c:\Sample.
You can interrogate the options as follows:
"dnu -help"
"dnu publish -help"

MSBuild SonarQube Runner v1.0 returns with code 1 after "Generating the FxCop ruleset"

I'm trying out SonarQube using the new MSBuild SonarQube Runner v1.0. If I install a fresh SonarQube server locally, the following command works fine, and I can build my solution directly afterward, call the 'end' command, and have the results published in SonarQube:
MSBuild.SonarQube.Runner.exe begin /key:TestKey /name:TestName /version:1.0.0.0
However, if I run this against an existing SonarQube server that exists on the internal network, it always returns with exit code 1:
15:32:40 Creating config and output folders...
15:32:40 Creating directory: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\conf
15:32:40 Creating directory: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\out
15:32:41 Generating the FxCop ruleset: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\conf\SonarQubeFxCop-cs.ruleset
Process returned exit code 1
It seems to download a lot of the dependencies into /.sonarqube, so communication with the server isn't an issue
Things I've tried:
checked the access.log, server.log and event logs
upgraded the existing server to v5.1.2 (clean install using the guide)
upgraded the sonar-csharp-plugin to v4.1
right-clicked all .jar files on the server and ensured they are unblocked
tried the runner directly on the server
(ongoing) tried debugging the source code (happening somewhere in the pre-process step: success comes back as true, but the error code is 1)
disabled UAC on the server an rebooted
re-installed JRE on both server and client, ensure JAVA_HOME in both PATH and registry are set correctly
Any help or pointers greatly accepted. I've been stuck on this for 2 days and can't think of anything else to try except continue trawling through source code. Thank you.
This is a tricky one! Looking at the code, I see only one path that can yield this output:
It fails while generating the FxCop ruleset for C#, as the VB.NET FxCop ruleset message is not logged - see TeamBuildPreProcessor.cs#L149 and TeamBuildPreProcessor.cs#L185
The GenerateFxCopRuleset() call for C# threw a WebException, leading to the call of Utilities.HandleHostUrlWebException() - which has to return true for the exception to be silently swallowed - see Utilities.cs#L153
The only path returning true without logging any message is if a HttpStatusCode.NotFound was received - see Utilities.cs#L158
The control flow goes back to FetchArgumentsAndRulesets(), which returns false, then goes back to Execute() which returns false as well - see TeamBuildPreProcessor.cs#L106
The MSBuild SonarQube Runner "begin" phase (called "preprocessor" in the code) fails - see Program.cs#L42
So, at some point, some SonarQube web service required for the C# FxCop ruleset generation is return a HTTP 404 error.
Could you monitor your network traffic and listen for the failing HTTP call? [I will keep on updating this answer afterwards]
EDIT: Indeed the error is caused by the quality profile name containing special characters. Such characters are currently badly URL-escaped, which leads to a 404.
I've created the following ticket to fix this issue in the upcoming release: http://jira.sonarsource.com/browse/SONARMSBRU-125

Can't get nservicebus performance counters to work in development/self host on windows server 2008 R2

Get this exception when running nservicebus.host.exe self-hosting either through Visual Studio or from command prompt. (Have tried both running from command prompt as administrator and my regular user):
2013-09-12 11:16:33,978 [1] FATAL NServiceBus.Hosting.GenericHost [(null)] <(nul
l)> - System.InvalidOperationException: NServiceBus performance counter for Crit
ical Time not set up correctly. Please run the NServiceBus infrastructure instal
lers to rectify this problem. ---> System.InvalidOperationException: Could not R
ead Category Index: 9340.
I've tried running the "RunMeFirst.bat" which seems to run fine:
C:\Program Files (x86)\NServiceBus\v3.3.4>runmefirst
C:\Program Files (x86)\NServiceBus\v3.3.4>echo off
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
Running infrastructure installers and exiting (ignoring other command line parameters if exist).
There is already a RavenDB service installed on this computer, current status:Running
Starting installation of PerformanceCounters
Installation of PerformanceCounters successful.
Checking if MSMQ is installed.
MSMQ is installed.
Checking that only needed components are active.
Installation is good.
Checking if DTC is configured correctly.
The machine is a windows server 2008 R2 with terminal services which is a shared development server for multiple devs. I suspect the stricter security on win server is to blame here since it works on my win 7 machine.
EDIT
Tried running "Install-PerformanceCounters" in Package Manager Console, but same problem. FYI, the output of Package Manager Console was (my command at the bottom):
Package Manager Console Host Version 2.2.40116.9051
Type 'get-help NuGet' to see all available NuGet commands.
Type 'get-help about_NServiceBus' to see all available NServiceBus commands.
What if: Performing operation "Install-PerformanceCounters" on Target "DEV01".
Performance Counters is setup and ready for use with NServiceBus
What if: Performing operation "Install-Msmq" on Target "DEV01".
Msmq is installed and setup for use with NServiceBus What if:
Performing operation "Install-Dtc" on Target "DEV01".
DTC is not properly configured
What if: Performing operation "Install-RavenDB" on Target "DEV01".
PM> Install-PerformanceCounters
True
PM>
Try using the powershell cmdlets, see http://docs.particular.net/nservicebus/operations/management-using-powershell
Thanks to the comment by John Simons I found the answer in this SO question: corrupted performance counters
In my particular case, running
lodctr /R
in admin command prompt was sufficient.

symstore error when running TFS 2010 build

Background:
I have several builds running on a Windows Server 2003 R2 machine via TFS2010. All of these build definitions have the Path to Publish Symbols set to "\\server\SymbolStore" and the builds run fine.
(Note - I have inherited this set up from a former employee, and I also have other builds running on a separate 2K8 machine that also run without issue)
I am now migrating these builds to a new Windows 2008 R2 build server using the same settings.
Problem:
When running the builds on the new build machine, everything is working fine until the build tries to run the "Publish Symbols" activity in the workflow, at which point I get the error
SYMSTORE ERROR: Class: Server. Desc: Couldn't connect to server.
Error 5: Access is denied. TF270015: 'symstore.exe' returned an
unexpected exit code. Expected '0'; actual '5'.
which also sets the build status to Partially Succeeded.
I have searched the web for these error messages to no avail so far, so does anyone know what might be causing this and how to get it working again?
As always, thanks in advance
Did you check the folder has the right permissions for the service account that is used by Team Build to create/write files ?
Turns out that after I had set up the new build machine, I had left the Credentials for the Build Service Properties (found in the Team Foundation Server Administration Console/Build Configuration) to its default setting which is "NT AUTHORITY\NetworkService". Once I had changed this to use the build service account, the builds are able to write to the symbol store properly