Why is Web Deployment Agent Service (MsDepSvc) crashing with a FileNotFoundException? - iis-7.5

I'm attempting to deploy a .NET 4 web application to a Windows 2008R2 server using Web Deploy V2. As part of this deployment we copy some batch files to the target machine. When I execute the command below, Web Deployment Agent Service (MsDepSvc) stops and a FileNotFoundException is logged to the system Application event log.
The web deploy command:
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V2\msdeploy.exe" -verb:sync -source:contentPath="C:\work\27f84e3eca3a33d5\Output\BatchFiles" -dest:contentPath="c:_DeployCommands",computerName="192.168.1.14"
Full console output:
C:\Windows\system32>"C:\Program Files (x86)\IIS\Microsoft Web Deploy
V2\msdepl y.exe" -verb:sync
-source:contentPath="C:\work\27f84e3eca3a 3d5\Output\BatchFiles"
-dest:contentPath="c:_DeployCommands",computer ame="192.168.1.14" Info: Using ID '326b55b4-602c-4cdf-ae5c-052e9d44b377' for connections
to the remote server. Warning: Retrying the sync because a socket
error (10054) occurred. Retrying operation 'Serialization' on object
MSDeploy.contentPath (sourcePath). Attempt 1 of 25. Info: Using ID
'a6e468ca-53b9-474b-8568-42dba196bd72' for connections to the remote
server. Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC More
Information: Could not connect to the destination computer
("192.168.1.14" using the specified process ("Web Deployment Agent
Service") because the serve did not respond. Make sure that the
process ("Web Deployment Agent Service") i started on the destination
computer. Error: The remote server returned an error: (503) Server
Unavailable. Error count: 1.
Event Log Entry:
Application: MsDepSvc.exe Framework Version: v4.0.30319 Description:
The process was terminated due to an unhandled exception. Exception
Info: System.IO.FileNotFoundException Stack: at
Microsoft.Web.Deployment.Tracer.TraceError(Microsoft.Web.Deployment.DeploymentTraceSource,
System.String, System.Object[]) at
MSDepSvc.WDAgent.BeginProcessRequest(System.Net.HttpListenerContext)
at System.Net.LazyAsyncResult.Complete(IntPtr) at
System.Net.ListenerAsyncResult.IOCompleted(System.Net.ListenerAsyncResult,
UInt32, UInt32) at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32,
UInt32, System.Threading.NativeOverlapped*)
How can I diagnose this?

We ran into a similar issue. You're best bet is to decompile using ILSpy and add extra logging in every catch block and replace the exe on the client to see the exact error. In our scenario, we used on older version 7.1.1631.0 that works. There's a newer version 7.1.1762.0 that's caused the problem. The exe is copied from the client and not the server.

I had the exact same issue. It turned out to be a bug in Web Deploy 3.5 as described here: Could not find file or assembly Microsoft.Web.Deployment.Tracing with Web Deploy V3 using tempagent

Related

Azure Devops release to IIS fails after AOT blazor wasm

I have a .NET 7.0 blazor wasm app, that I deploy to a windows server running IIS. This has worked fine, until i added the following to my project (The client, and the project is .net core hosted):
<WasmEnableSIMD>true</WasmEnableSIMD>
<RunAOTCompilation>true</RunAOTCompilation>
First i got the following error in my build pipeline:
error NETSDK1147: To install these workloads, run the following command: dotnet workload restore
So i added a command line step to my build pipeline where i run the following command:
dotnet workload restore
So far so good. Now the project builds again. But my release now fails. I have 3 steps in my release pipeline for my IIS server:
Stop app pool
deploy my app
start my app pool
This worked fine before adding the two statements above. But now i get the following error:
Failed to deploy web package to IIS website.
Error: Unrecognized argument 'Files\IIS\Microsoft'. All arguments must begin with "-".
Error count: 1.
Error: The process 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe' failed
with exit code 4294967295
I can't seem to find a solution, so has anyone tried something similar?
Apparently i wasn't the only one with the issue:
https://github.com/microsoft/azure-pipelines-tasks/issues/17634
I ended up removing web deploy 4.0, and now it works again.
Maybe if I had waited longer, i wouldn't have to remove web deploy 4.0

AzureApp HTTP Error 500.30 - ASP.NET Core app failed to start

Works locally but NOT on Azure AppService
Using: Visual Studio 2022
Asp.Net MVC .NET 6
AzureApp Platform: Windows 32/bit
My App is a sample
I went through through from AzureAppSample
I am able to run it locally on mymachine. It is when I deploy to Azure using Visual Studio 2022 and then view my public URL that I get the error. When I look at the logs in Azure using Kudu I find "Application ...../ROOT' with physical root 'C:\home\site\wwwroot\' failed to load coreclr. Exception message: CLR worker thread exited prematurely</Data>"
Try adding the following to your configuration so that you can get a better idea of what the error is:
ASPNETCORE_DETAILEDERRORS = 1

Azure DevOps release deployment failing Disk Space Error

I have an app I am trying to deploy through azure's DevOps pipeline. I have successfully deployed apps before, and the first build of this app deployed fine. However all subsequent builds have been failing at the deployment step. They seem to be specifically failing at the "Deploy Azure App Service" step, generating a ERROR_NOT_ENOUGH_DISK_SPACE error code.
The deployment terminal output shows the following errors:
Got connection details for Azure App Service:'MMOMarketTracker'
[command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\a\r1\a\_MMMarketTracker\build\build.zip' -dest:contentPath='MMOMarketTracker',ComputerName='https://mmomarkettracker.scm.azurewebsites.net:443/msdeploy.axd?site=MMOMarketTracker',UserName='$MMOMarketTracker',Password='***',AuthType='Basic' -enableRule:AppOffline -enableRule:DoNotDeleteRule -userAgent:VSTS_ba2ca09f-578d-4893-99ac-412c3f26fde5_release_1_9_9_1
2018-11-22T21:02:35.2302461Z Info: Using ID 'e7a243b1-97df-4ec2-b8d9-c679c2e35512' for connections to the remote server.
Info: Adding directory (MMOMarketTracker\s\.git\objects\15).
Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
at ChildProcess.<anonymous> (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.4.16\node_modules\vsts-task-lib\toolrunner.js:568:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
[command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\a\r1\a\_MMMarketTracker\build\build.zip' -dest:contentPath='MMOMarketTracker',ComputerName='https://mmomarkettracker.scm.azurewebsites.net:443/msdeploy.axd?site=MMOMarketTracker',UserName='$MMOMarketTracker',Password='***',AuthType='Basic' -enableRule:AppOffline -enableRule:DoNotDeleteRule -userAgent:VSTS_ba2ca09f-578d-4893-99ac-412c3f26fde5_release_1_9_9_1
Info: Using ID '201db2e8-ee9f-4e39-9a29-2187cb7056bd' for connections to the remote server.
Info: Adding directory (MMOMarketTracker\s\.git\objects\15).
##[error]Failed to deploy web package to App Service.
##[error]Error Code: ERROR_NOT_ENOUGH_DISK_SPACE
More Information: Web Deploy detected insufficient space on disk. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_NOT_ENOUGH_DISK_SPACE.
Error: The error code was 0x80070070.
Error: There is not enough space on the disk.
at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath)
at Microsoft.Web.Deployment.DirectoryEx.CreateDirectory(String path)
at Microsoft.Web.Deployment.DirPathProviderBase.CreateDirectory(String fullPath, DeploymentObject source)
at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf)
Error count: 1.
##[error]Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
The first error seems to be caused by the remote server failing to add a git object. This error will usually occur 2-3 times each deployment, and will result in the "Retrying to to deploy the package" message shown.
The second error will happen once and will end the deployment. I have been to the link the error recommends and there is no help section for this type of error.
I downloaded the build file and it is only 49.3 MB large, and the Microsoft servers have a 10GB size for deployments. I am running on a hosted build agent, not a private one.
Other questions I found online similar to this are mostly unanswered. Some have been updated later to say the deployment started working for seemingly no reason.
Any help would be appreciated.
For anyone else who gets the same problem, I basically had too many other apps taking up space on my azure account. The article Brendan Green linked explains this.
(https://blogs.msdn.microsoft.com/puneetgupta/2017/06/06/azure-app-service-what-is-taking-my-disk-space-for-my-azure-web-app/)
By going to the Quotas page on any of your azure apps (in the azure portal) you can see how much space you have left.
This happens when you're out of staging slots in your pricing tier. So, a workout solution is to upgrade your pricing tier to acquire more staging slots.
The staging slots are used for testing and deployments before swapping them into production and it does not associate with your file system disk space.
You may be able to reclaim disk space by triggering the build agent cleanup process.

Azure Function App - Publish failed

I'm unable to publish (WebDeploy) my Azure Function App (It's a Durable Function, I know it deosn't matter, but, just in case if matters). This started happening today.
I'm getting a "Publish Failed" popup and the below error message in the output window of my Visual Studio.
Error Message
<ProjectName> -> C:\search\source\<Solution Folder>\obj\Release\netstandard2.0\PubTmp\Out\
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Web deployment task failed. (Could not connect to the remote computer ("<functionappname>.scm.azurewebsites.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.) [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : The requested resource does not exist, or the requested URL is incorrect. [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Error details: [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Could not connect to the remote computer ("<functionappname>.scm.azurewebsites.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE. [<projectname>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : The remote server returned an error: (404) Not Found. [<projectname>.csproj]
Publish failed to deploy.
Function Runtime - beta
When I access the Function App Url in a browser I get "Your Function App 2.0 preview is up and running" message". And, I don't see anything wrong in the Kudu portal as well.
I have deleted the Function and re-created it with the same name with no luck.
Any help is much appreciated.
Update : Here is another error that I'm getting as well.
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Web deployment task failed. ((7/25/2018 1:16:27 PM) An error occurred when the request was processed on the remote computer.) [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : (7/25/2018 1:16:27 PM) An error occurred when the request was processed on the remote computer. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : An error was encountered when processing operation 'Create Directory' on 'D:\home\site\wwwroot\bin'. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : The error code was 0x800703E6. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Invalid access to memory location. [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath) [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : at Microsoft.Web.Deployment.FileSystemInfoEx.set_Attributes(FileAttributes value) [<Project Name>.csproj]
C:\Program Files\dotnet\sdk\2.1.202\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf) [<Project Name>.csproj]
Publish failed to deploy.
Thanks,
Praveen
I fixed this issue by setting WEBSITE_RUN_FROM_PACKAGE to 0 on the application settings. I was uploading the function files by syncing a WebDeploy package from Azure DevOps to the App Service file system and not running it from the .zip package.
On https://learn.microsoft.com/bs-cyrl-ba/azure/azure-functions/run-functions-from-deployment-package explains about running Functions from a deployment package and all the benefits of doing it this way, but then remember to:
Just upload the .zip deployment package to d:\home\data\sitepackages (don't use the msdeploy verb "sync" to sync the file system at wwwroot)
Add a packagename.txt containing only the name of the package file in folder, without any whitespace
Go to azure portal, stop the function app, publish from vs, then start again.
Don't know if this is closed but I had same issue while deploying new SDK version to an older azure function app. Here is what I did:
Instead of downloading deployment profile from Azure portal, created a new one with visual studio automated deployment.
This is important- While deploying from Visual studio it should ask you to upgrade version of deployed app, click yes and your app will get deployed.
Can't reproduce your error when using WebDeploy with SCM. When I set WEBSITE_WEBDEPLOY_USE_SCM to false(in Application settings) to avoid using SCM, I saw An error was encountered when processing operation 'Create Directory' on 'wwwroot' like the second error you have met.
Several options to try:
Visit https://functionappname.scm.azurewebsites.net in browser to check whether your network environment is fine and has no firewall restriction.
Check whether you have proxy set like Fiddler when publishing.
Go to portal, Reset publish credentials then Download publish profile. Delete old publish profiles and import the new one to publish again.
If all of those suggestions fail, delete all old resources relate to the function. Then create a brand new function app with new app service plan and storage. Try to publish to this new app.
This seems to happen to me when I have made changes that for some reason necessitate the following.
Rebuild the project (make sure you can run it locally).
Click to publish, but prior to that click on "Manage Application Settings" do
a quick check and click OK.
Attempt to publish.
If that fails close visual studio and azure portal (stop running or disable all relevant objects) and repeat.
Worst case create a new profile and deploy to that.
It was easy to miss for me...but the Function on Azure was blocking my publish from Visual Studio 2017.
What was needed was a restart of the Function on Azure.
1) Go to Azure Portal and click into your Function app.
2) Click on the name of your Function, and then in the Overview tab - in the second-row menu you should see Restart. (You'll see it in the row with: Stop - Swap - Restart - Get publish profile...etc.)
3) Click Restart
4) Go back to Visual Studio 2017 and Republish.
My error message which I initially missed:
C:\Program Files\dotnet\sdk\2.2.103\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): error : Web deployment task failed. (Web Deploy cannot modify the file 'MyApp.Functions.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.) [C:\Github\2019AzureBlobLocalOnly\MyApp.Functions\MyApp.Functions.csproj]
A similar issue to #Andrew Chung where there were locks on the files in Azure and it couldn't delete old function dll files. I was trying to upgrade to .NET core and publish from a different project. Unfortunately, i didn't see his response until it was too late, and had followed #Jerry Liu's advice (#4) to remove the function app and add in a new one. This didn't seem to work for me as until I recreated the app with a different name. I suspect there may be a DNS conflict where xxxx.scm.azurewebsites.net is still pointing to the IP address of your old decommissioned app.

MSDeploy fails with authorization error when using filePath provider

I am trying to deploy a web application using MSDeploy. In the first step the app is deployed to test server (using the package created during the build), then to production server (source and destination are iisApp) and the next step is production web.config file deployment to the production server.
Everything works fine but the web.config file deployment reports an error
Error Code: ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER
More Information: Could not complete an operation with the specified
provider ("filePath") when connecting using the Web Management Service.
This can occur if the server administrator has not authorized the user for
this operation. filePath http://go.microsoft.com/fwlink/?LinkId=178034
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER.
I am using the same machine for deployment, the same username and the same password. I can see the user has filePath deployment enabled (as well dirPath, contentPath, iisApp and setAcl) in the Management Service Delegation screen in IIS Manager on the machine used for deployment:
It also fails for dirPath and contentPath.
Can anybody help? Thanks
Update - log when MSDeploy executed with -verbose flag
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy"
-verb:sync -source:filePath="C:\MyProject\DeployConfig\web\web.config"
-dest:filePath="web/web.config",computerName="https://deployement:8172/MSDeploy.axd?site=my-site",userName="publish",password="password",authtype="Basic",includeAcls="False"
-allowUntrusted -verbose
Info: Using ID '7fcedfe4-c103-48f4-ab98-4fae743d5eb7' for connections to the remote server.
Verbose: Pre-authenticating to remote agent URL 'https://deployment:8172/MSDeploy.axd?site=my-site' as 'publish'.
Verbose: Performing synchronization pass #1.
Verbose: Pre-authenticating to remote agent URL 'https://deployment:8172/MSDeploy.axd?site=my-site' as 'publish'.
Verbose: No backup was executed.
Verbose: Received response from agent (HTTP status 'OK').
Info: Adding MSDeploy.filePath (MSDeploy.filePath).
Verbose: The dependency check 'DependencyCheckInUse' found no issues.
Verbose: The current synchronization pass is missing stream content for 1 objects.
Info: Using ID '8f582c09-614e-4344-87c9-64867e44fc4e' for connections to the remote server.
Verbose: Performing synchronization pass #2.
Verbose: Pre-authenticating to remote agent URL 'https://deployment:8172/MSDeploy.axd?site=my-site' as 'publish'.
Info: Adding MSDeploy.filePath (MSDeploy.filePath).
Verbose: Received response from agent (HTTP status 'OK').
Info: Adding child MSDeploy.filePath (C:\MyProject\DeployConfig\web\web.config).

Resources