Publish Failed Error while publishing Azure functions on azure - azure

I am getting error while publishing azure functions on azure portal.I tried lot of things and visited lot of links but didn't find any suitable soltuion.
Below is the output in output window.
Azure Application Settings updated.
1>------ Build started: Project: AwepayReconcile.DAL, Configuration: Release Any CPU ------
1>Models\AwepayContext.cs(26,10,26,214): warning CS1030: #warning: 'To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.'
1>AwepayReconcile.DAL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DAL\bin\Release\netcoreapp2.1\AwepayReconcile.DAL.dll
1>Done building project "AwepayReconcile.DAL.csproj".
2>------ Build started: Project: AwepayReconcile.DL, Configuration: Release Any CPU ------
2>Infrastructure\Extensions.cs(34,42,34,44): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(177,36,177,38): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(210,36,210,38): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(304,30,304,32): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(403,30,403,32): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(40,36,40,42): warning CS0169: The field 'ReconcileService.hssfwb' is never used
2>Services\ReconcileService.cs(38,33,38,38): warning CS0169: The field 'ReconcileService.sheet' is never used
2>Services\AzureBlobStorageService.cs(29,29,29,41): warning CS0414: The field 'AzureBlobStorageService._appSettings' is assigned but its value is never used
2>AwepayReconcile.DL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DL\bin\Release\netcoreapp2.1\AwepayReconcile.DL.dll
2>Done building project "AwepayReconcile.DL.csproj".
3>------ Build started: Project: AwepayReconcile.AzureFunctionsApp, Configuration: Release Any CPU ------
3>AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\bin\Release\netcoreapp2.1\bin\AwepayReconcile.AzureFunctionsApp.dll
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Publish Started
AwepayReconcile.DAL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DAL\bin\Release\netcoreapp2.1\AwepayReconcile.DAL.dll
AwepayReconcile.DL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DL\bin\Release\netcoreapp2.1\AwepayReconcile.DL.dll
AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\bin\Release\netcoreapp2.1\bin\AwepayReconcile.AzureFunctionsApp.dll
AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\obj\Release\netcoreapp2.1\PubTmp\Out\
Publishing D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\obj\Release\netcoreapp2.1\PubTmp\AwepayReconcile.AzureFunctionsApp - 20190320182641787.zip to https://awepayreconcileazurefunctionsapp20190320061400.scm.azurewebsites.net/api/zipdeploy...
C:\Users\tejinder.s\.nuget\packages\microsoft.net.sdk.functions\1.0.26\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.ZipDeploy.targets(42,5): error : The attempt to publish the ZIP file through https://awepayreconcileazurefunctionsapp20190320061400.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code RequestTimeout. [D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp.csproj]
Please help me to git rid of this.
Thanks

When deploying your function app to Windows, you should set WEBSITE_RUN_FROM_PACKAGE to 1 and publish with zip deployment.
Zip deployment is a feature of Azure App Service that lets you deploy your function app project to the wwwroot directory. The project is packaged as a .zip deployment file. The same APIs can be used to deploy your package to the d:\home\data\SitePackages folder.
With the WEBSITE_RUN_FROM_PACKAGE app setting value of 1, the zip deployment APIs copy your package to the d:\home\data\SitePackages folder instead of extracting the files to d:\home\site\wwwroot. It also creates the packagename.txt file. The function app is then run from the package after a restart, and wwwroot becomes read-only.
For more details, you could refer to this article.

Related

What means Range error on my Release pipelines?

When the release pipeline run end up with this error
RangeError [ERR_INVALID_OPT_VALUE]: The value "4294967295" is invalid for option "size".
I don't know what means this error
task failed
Log of the task failed when release run
Same issue for me using Web Deploy to a nodejs app service.
Web Deploy worked at first, until we added some packages in our package.json (e.g. "#fortawesome/free-brands-svg-icons")
Then our release pipeline suddenly outputs "64-bit = +" in the deployment log.
If we remove the packages, the "64-bit = +" is gone, and our Web Deploy works again.
Image of log from Release pipeline
Not sure how to resolve it, but in our case we used Zip Deploy instead like #Ari Gunawan recommended.
I had the same issue when trying to deploy a node app to Azure App Service from release pipeline. Not sure what the error means as there are no further details about it but I resolved it by using "Zip Deploy" deployment method and "Continue on error"

Azure CD pipeline can't find build artifacts

Below is Azure error log from the Azure release pipeline.
2020-07-24T05:17:13.7712974Z ##[section]Starting: Deploy Azure App Service
2020-07-24T05:17:14.0464143Z ==============================================================================
2020-07-24T05:17:14.0465719Z Task : Azure App Service deploy
2020-07-24T05:17:14.0469391Z Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2020-07-24T05:17:14.0469849Z Version : 3.163.5
2020-07-24T05:17:14.0470410Z Author : Microsoft Corporation
2020-07-24T05:17:14.0470921Z Help : https://aka.ms/azureappservicetroubleshooting
2020-07-24T05:17:14.0471274Z =============================================================================
2020-07-24T05:17:16.0650643Z Got connection details for Azure App Service:'XXXXX'
2020-07-24T05:17:17.6576087Z (node:764) Warning: Use Cipheriv for counter mode of aes-256-ctr
**2020-07-24T05:17:17.6627737Z ##[error]Error: No package found with specified pattern: D:\a\r1\a\Drop<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.**
2020-07-24T05:17:22.9168975Z Successfully added release annotation to the Application Insight : XXXXX
2020-07-24T05:17:24.8686063Z Successfully updated deployment History at https://XXXXX.scm.azurewebsites.net/api/deployments/231595567842919
2020-07-24T05:17:24.8933576Z ##[section]Finishing: Deploy Azure App Service
P.S. I have checked build pipeline, I can download build Artificats, but it displays below warning.
[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'.
Assuming you meant you have solved the build artifact empty issue, but the release pipeline still had issue in Azure App Service deploy task.
As the error mentioned, there is "No package found with specified pattern: D:\a\r1\a\Drop", you need to check how you define the package, try format $(System.DefaultWorkingDirectory)/**/*.zip instead of $(System.DefaultWorkingDirectory)\Drop.
As task "Publish Build Artifact" publish artifact from $(build.artifactstagingdirectory), so we need add a task "Copy files" to copy your files ** from $(system.defaultworkingdirectory) to $(build.artifactstagingdirectory) **. which copied my build to stagingdirectory.

dotnet publish Error: The process cannot access the file because it is being used by another process

I get the following error when tring to run dotnet publish:
The process cannot access the file because it is being used by another
process.
This appears to happen when you try to publish your app and you have been viewing the published version in the browser, for some reason it locks out the files.
Full error message:
C:\Program Files\dotnet\sdk\2.2.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(169,5): warning MSB3026: Could not copy "obj\Debug\netcoreapp2.2\TemplateWebApp.dll" to "bin\Debug\netcoreapp2.2\publish\TemplateWebApp.dll". Beginning retry 1 in 1000ms. The process cannot access the file '\cpft-bi-web01\d$\Websites\TemplateWebApp\bin\Debug\netcoreapp2.2\publish\TemplateWebApp.dll' because it is being used by another process. [\cpft-bi-web01\d$\Websites\TemplateWebApp\TemplateWebApp.csproj]
I can resolve this by closing the browser and the restarting the website on IIS Manager but this is really not ideal, does anyone know the cause of this?
To solve it, i recycle the apppool.
On local environment, i have a Post Build Event Project -> Properties -> Build Events -> Post-build event command line, that runs a .bat file that sits in project directory.
This is the code from bat file:
%SYSTEMROOT%\System32\inetsrv\appcmd recycle apppool /apppool.name:"YOUR APP POOL NAME"
dotnet publish --force --no-build
pause
Just make sure you replace YOUR APP POOL NAME with your actual pool name (and keep the double quotes)
So every time i build the solution, it recycles the pool and publishes the app. Because i just build the app (right before publishing), i specify --no-build to publish command.
I had the same error. Stopping the application pool on IIS, then publishing, then starting the pool again worked for me.

Unable to publish node.js app from VS2015 using VS publish

I’ve got a node.js project which I’m using to publish to Azure. This worked fine the first couple of times I’ve published, but now when I try and publish it just fails with no error message. The output in the Azure Service Activity window in VS2015 is simply:
Auto ConnectionString Transformed Web.config into obj\Release\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
And the output from the ouput/build window is:
------ Publish started: Project: node, Configuration: Release Any CPU ------
Auto ConnectionString Transformed Web.config into obj\Release\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
I don’t really know where to start diagnosing this as there is no error message per se.
Things I’ve tried thus far:
Full Clean and/or rebuild
Deleted all folders from the BIN directory
Deleted all folders from the obj directory
Tried both debug and release configurations
Deleting the publish profile from VS and re-adding it from scratch
None of the above has made any difference
Has anyone seen this issue before or could suggest where to start diagnosing the cause?
Thanks
Do you happen to have GhostDoc installed?
Uninstalling it fixed it for me after seeing this issue.
I had the same issue, and it was due to file paths getting long more than the allowed number of characters. use this module to make your file paths shorter, and it will fix this issue
https://www.npmjs.com/package/flatten-packages

Visual Studio deployment doesn't activate SharePoint feature

I have a simple SharePoint project with one farm-scoped feature. The feature contains no modules; it just refers to an SPClaimProviderFeatureReceiver-derived class which in turn points to an SPClaimProvider-derived class.
When I tell the project to deploy, it does successfully add the assembly to the GAC, and does successfully create Feature.xml within a folder in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES, and gives this output:
------ Build started: Project: xxx, Configuration: Debug Any CPU ------
xxx -> E:\xxx\bin\AnyCPU\Debug\xxx.dll
Successfully created package at: E:\xxx\xxx.wsp
------ Deploy started: Project: xxx, Configuration: Debug Any CPU ------
Active Deployment Configuration: Default
Run Pre-Deployment Command:
Skipping deployment step because a pre-deployment command is not specified.
Recycle IIS Application Pool:
Skipping application pool recycle because no matching package on the server was found.
Retract Solution:
Skipping package retraction because no matching package on the server was found.
Add Solution:
Adding solution 'xxx.wsp'...
Deploying solution 'xxx.wsp'...
Activate Features:
No features in this solution were activated.
Run Post-Deployment Command:
Skipping deployment step because a post-deployment command is not specified.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
The deployed Feature.xml:
<?xml version="1.0" encoding="utf-8"?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Title="xxx"
AutoActivateInCentralAdmin="TRUE"
Description="xxx"
Id="063aae98-029f-4c01-a20e-15b6c8576bc8"
ReceiverAssembly="xxx, Version=0.1.0.0, Culture=neutral, PublicKeyToken=6e7f8ba8e1265a7f"
ReceiverClass="xxx" Scope="Farm" />
I'm concerned that it says that no features were activated. The WSP does show up in Central Administration Solution Management, but says that it "isn't deployed", and the feature doesn't show up in Manage Farm Features. When I click on Deploy in the web interface, it says "The solution was successfully deployed" (Why didn't VS do this??). But after that the feature still doesn't show up.
In VS solution explorer, right click on project >> select properties >> select sharepoint tab
Here you have different 'Active deployment configuration'. make sure you have selected appropriate configuration from drop down list. you can modify and view steps of each configuration.
If you get this kind of error while deploying your solutions to sharepoint environment, ensure that your project is not a sandboxed solution.
Click on your project, go to properties window in Visual Studio and change the value of Sandboxed Solution from true to false. Rebuild your project and deploy.
skipping pre and post deployment command is only a warning because you haven't specified any command for these steps.
in VS SharePoint tab (see Rahil answer on how to get there), you have 2 text boxes for writing your pre and post commands

Resources