Attempt to publish the ZIP file through https://xxx.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code Forbidden - azure

I'm getting this error window message while trying to deploy a .NET 6 Azure Functions app to Azure from Visual Studio 2022:
Publish has encountered an error. We
were unable to determine the cause of the error. Check the output log
for more details.
A diagnostic log has been written to the following location:
"C:\Users\MyUserName\AppData\Local\Temp\tmpEB87.tmp"
The tmpEB87.tmp file contents look like this:
2/16/2022 1:43:18 PM
System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
===================
The Output log says this:
The attempt to publish the ZIP file through
https://xxx.scm.azurewebsites.net/api/zipdeploy failed with HTTP
status code Forbidden.
The MyFunctionName - Zip Deploy.pubxml file contents looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>ZipDeploy</WebPublishMethod>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://xxx.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<ResourceId>/subscriptions/some-random-letters-123456789/resourceGroups/my-resource-group-name/providers/Microsoft.Web/sites/MyFunctionName</ResourceId>
<UserName>$MyFunctionName</UserName>
<_SavePWD>True</_SavePWD>
<IsLinux>true</IsLinux>
<PublishUrl>https://xxx.scm.azurewebsites.net/</PublishUrl>
</PropertyGroup>
</Project>
I've already spent a ton of time on this, so any help is appreciated.

One of the workarounds that you can try is to create a new Publish profile and publish it again. For this navigate to Your project's directory -> Properties -> Publish Profiles and delete the contents (or you can move to another location). Finally, click Finish in the publish profile wizard again.
Make sure WEBSITE_RUN_FROM_PACKAGE is 1 from your Application settings. Also, try restarting your function app.
NOTE:- When deploying from Visual Studio, you should be asked whether you want to upgrade the version of the app that is currently deployed. If you say yes, your app will be deployed.

Related

IIS Manager crashes when adding a URLRewrite rule

I am trying to add a URLRewrite blank rule to one of our servers, but when I select it and click OK to add it, IIS Manager closes abruptly.
I checked in the Event Log Viewer and there was an IISM crash with this message:
IISMANAGER_CRASH
IIS Manager terminated unexpectedly.
Exception:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Web.Management.Server.WebManagementServiceException: Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Error: The configuration section 'webFarms' cannot be read because it is missing a section declaration
---> System.Runtime.InteropServices.COMException: Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Error: The configuration section 'webFarms' cannot be read because it is missing a section declaration
it looks like your config file is missing webfarms, section should be put directly under configuration node as the declaration in configSections.
Please double check if the section is configured at the correct place.

Web Deploy package throws ERROR_SITE_DOES_NOT_EXIST when deployed

After creating a WDP from an aspnet solution, the [project name].deploy.cmd file returns this error when executed:
Error Code: ERROR_SITE_DOES_NOT_EXIST
More Information: Site 'freedomstoreusa.azurewebsites.net' does not exist. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SITE_DOES_NOT_EXIST.
Error count: 1.
My objective is to deploy the package to this site as if it were publishing to azure from visual studio 2017. What is causing this issue, what can resolve it and what are some alternatives to packaging and deploying a website?
Here are my settings in the package wizard:
what can resolve it and what are some alternatives to packaging and deploying a website?
I build and package the web application project, and use MSDeploy.exe to deploy the web application, which works fine on my side.
Command:
TestSite.SetParameters.xml
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="{app name}" />
</parameters>
I came here with the same problem but the image in the question and the answer from Fei Han solve my problem I was creating a File System Package not a Web Deploy Package which will create App.SetParameters.xml and the App.zip in the selected folder it also will ask for the app name an then you can use that auto generated file for the param -setParamFile:

Publish on TFS does not find the pubxml file for Node.js test project

I created a Node.js project for an protractor test environment using the Node.js Tools to test a web application on a team foundation server. The test project and the web application are in one solution file. However, if i want to deploy the Node.js project on the tfs, it is not able to find the pubxml file located in the web application project.
Error log:
12>CoreCompile:
Creating directory "bin".
Copying file from "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Node.js Tools\Microsoft.NodejsTools.WebRole.dll" to "bin\Microsoft.NodejsTools.WebRole.dll".
ValidatePublishProfileSettings:
Validating PublishProfile(TestProfile) settings.
12>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4364,5): error : The value for PublishProfile is set to 'TestProfile', expected to find the file at '<PATH>\TestProject.Web.Protractor.Tests\__profiles\TestProfile.pubxml' but it could not be found. [<PATH>\TestProject.Web.Protractor.Tests.njsproj]
12>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4371,4): error : PublishProfile(TestProfile) is set. But the $(WebPublishMethod) does not have a valid value. Current Value is "". [<PATH>\TestProject.Web.Protractor.Tests.njsproj]
12>Done Building Project "<PATH>\TestProject.Web.Protractor.Tests.njsproj" (default targets) -- FAILED.
After analyzing the Microsoft.Web.Publishing.targets i found the PublishProfileRootFolder variable to change the search path for the pubxml file.
First i tried to place the variable inside the MSBuild arguments. However, this raised problems with other test projects and i was not able to use variables like the $(SolutionDir).
I ended trying to use the PublishProfileRootFolder variable inside the project file and this works now:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
...
<PublishProfileRootFolder>$(SolutionDir)PathToWebApplication\Properties\PublishProfiles</PublishProfileRootFolder>
</PropertyGroup>
...
PS: Additionally you need a Web.config file, placed in the project root of the test project:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="on"/>
<compilation debug="true"/>
</system.web>
</configuration>

Error ERROR_COULD_NOT_CONNECT_TO_REMOTESVC while using msbuild from command prompt

I am trying to deploy my webproject using msbuild tool in command line as shown below -
msbuild MyWebProject.vbproj /p:DeployOnBuild=true
/p:PublishProfile="MyWebProject - Web Deploy - Test"
/p:Configuration=Debug
But I am getting following error -
msdeploy error ERROR_COULD_NOT_CONNECT_TO_REMOTESVC: Web deployment task failed. (Could not connect to the remote computer ("MyWebProject.scm.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.) [C:\XXXX\XXXX\MyWebProjectSolution\MyWebProject\MyWebProject.Web.vbproj]
Here is the Publish Profile I am using -
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://MyWebProject.azurewebsites.net/tMyApp</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>MyWebProject.scm.azurewebsites.net:443</MSDeployServiceURL>
<DeployIisAppPath>MyWebProject/tMyApp</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$MyWebProject</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
<PublishDatabaseSettings>
......
</PublishDatabaseSettings>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)MyWebProjectDB-Web.config Connection String">
<UpdateDestWebConfig>False</UpdateDestWebConfig>
</MSDeployParameterValue>
</ItemGroup>
</Project>
When I manually publish my web app using the same publish profile file, it works just fine.
Here is the request and Response msbuild makes (captured using fiddler) -
------- Raw Request -----
CONNECT MyWebProject.scm.azurewebsites.net:443 HTTP/1.1
Host: MyWebProject.scm.azurewebsites.net
Proxy-Connection: Keep-Alive
------- Auth -----
No Proxy-Authorization Header is present.
No Authorization Header is present.
------- Raw Response -----
HTTP/1.1 0 Connection passed to Gateway - Result unknown
EndTime: 10:26:35.164
Please see the image below for details of fiddler request.
Any idea what might be going wrong with my msbuild command ?
I ran into this issue, for me the fix was to add my ip to the SCM site restrictions:
Azure portal -> Your app service -> Networking -> Configure Access Restrictions -> scm tab -> Add rule
https://learn.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions#restrict-access-to-an-scm-site

Cruisecontrol.net with UCM Clearcase - How to?

I am trying to configure Cruisecontrol.net for UCM Clearcase for the first time. Following is the sourceControl tag in the ccnet.config file:
<sourcecontrol type="clearCase">
<branch>123_India_Release</branch>
<autoGetSource>true</autoGetSource>
<viewName>admin_123_CRUISE</viewName>
<viewPath>$(ViewDirectory)</viewPath>
<useLabel>false</useLabel>
<useBaseline>false</useBaseline>
<executable>cleartool.exe</executable>
</sourcecontrol>
I constantly receive the following error:
ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control
operation failed: cleartool: Error: Not an object in a vob: "PATH TO
THE VIEW"
When I run cleartool from an arbitrary directory with the following parameters:
cleartool.exe lshist -r -nco -branch "123_India_Release" -since
05-Dec-2012.14:38:18 -fmt
I get the same error. But if I change the working directory to $(ViewDirectory) before running cleartool, it runs fine.
How should I make Cruisecontrol.net run cleartool.exe from the $(ViewDirectory)?
I have already tried adding <workingDirectory>$(ViewDirectory)</workingDirectory> tag before <executable>cleartool.exe</executable> but it did not work.
Any help would be appreciated.
EDIT 1:
As a workaround I have done the following:
<exec>
<executable>cleartool.exe</executable>
<baseDirectory>d:\Workspace\123_India_Release\VOB</baseDirectory>
<buildArgs>update -force</buildArgs>
<buildTimeoutSeconds>6000</buildTimeoutSeconds>
</exec>
I have added this to the tasks tag. I have configured an hourly trigger which does the following:
1) Update snapshot view
2) Build the VS 2010 solutions mentioned in the tasks tag.
The limitations are:
1) The trigger is hourly. I want it to be a commit based trigger.
2) This is a workaround
EDIT 2:
Further experimentation revealed that the ccnet.exe works fine. It does all that is needed. The issue is caused by the service ccservice.
I have stopped ccservice for now and started ccnet.exe. I plan to leave it running.
The View directory isn't enough: you must specify a vob.
See for instance:
"clearfsimport: Error: Not an object in a vob: "\"." (as an illustratio of that error message)
this thread (or this one): "You have to specify explicitly the VOB(s) to check for modification set"
The path should looks like:
<viewPath>Drive:\path\to\view\vobname</viewPath>
If your $(ViewDirectory) already references Drive:\path\to\view, then you could use:
<viewPath>$(ViewDirectory)\vobname</viewPath>

Resources