Web Deploy package throws ERROR_SITE_DOES_NOT_EXIST when deployed - azure

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:

Related

Web Package: How to force MSBuild to use MSDeploy.IisApp instead of sitemanifest?

How do I force MSBuild to create a Web Package that uses the iisApp Provider Application Path such as "Default Web Site/Catalog"?
My build process is creating a package that uses a directory path (C:\Agent\_work\28\s\Catalog).
I have tried to add the "/p:DeployAsIisApp=True" in my MSBuild command, but that doesn't seem to make a difference.
If I set the virtual directory to my Visual Studio 2017 solution folder, then Export a Package through IIS Manager, the package is created the way I'm expecting.
I compared the archive.xml files between MSBuild and the IIS Export. Here is some partial output:
MSBuild:
<sitemanifest MSDeploy.ObjectResolver.createApp= ...>
<iisApp path="C:\Agent\_work\28\s\Catalog ...>
...
</sitemanifest>
IIS Export:
<MSDeploy.IisApp MSDeploy.ObjectResolver.createApp= ...>
<iisApp path="Default Web Site/Catalog" ...>
...
</MSDeploy.IisApp />
So IIS is exporting MSDeploy.IisApp while MSBuild is creating a sitemanifest.
How do I get MSBuild to match the IIS Export? I'm using the VSTS build system and the parameters I'm passing to MSBuild are:
MSBuild /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\Catalog" /p:IncludeSetAclProviderOnDestination=False
I solved the issue.
The specific issue I had been experiencing was a line in the logs that looked like this:
Verbose: Parameter entry 'IIS Web Application Name/1' could not be applied anywhere.
Parameters.xml was this (broken):
<parameters>
<parameter name="IIS Web Application Name"
description="Full site path where you want to install the Catalog Application (for example, Default Web Site/Catalog)."
defaultValue="Default Web Site/Catalog"
tags="IisApp">
<parameterEntry kind="ProviderPath" scope="iisApp" match="#defaultValue" />
</parameter>
I set the match attribute to an empty string. Then everything started working as expected. Working:
<parameters>
<parameter name="IIS Web Application Name"
description="Full site path where you want to install the Catalog Application (for example, Default Web Site/Catalog)."
defaultValue="Default Web Site/Catalog"
tags="IisApp">
<parameterEntry kind="ProviderPath" scope="iisApp" match="" />
</parameter>

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>

IIS WebDeploy using MS Build Fails with error MSB4044 -ConcatFullServiceUrlWithSiteName task

In setting up a Jenkins deployment job, I kept running into this error when trying to deploy a Visual Studio 2012 Web project via the command line.
error MSB4044: The "ConcatFullServiceUrlWithSiteName" task was not given a value for the required parameter "SiteAppName"
For reference, here are the parameters that I used:
/p:Configuration=Release /t:Rebuild /p:VisualStudioVersion=11.0 /p:PublishProfile="DeployToDevServer"
/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish
/P:AllowUntrustedCertificate=True /p:MSDeployPublishMethod=WMSvc
/p:MsDeployServiceUrl=https://devmachine.server.com:8172/MsDeploy.axd
/p:username=domainhere\adminuserhere /p:password=adminpasshere
Note: It would deploy just fine if I chose Publish... from inside the project.
After much googling, and finally comparing a project that would deploy with the one that wouldn't, I finally figured it out after I opened the .csproj files with a text editor and compared them.
In the project that worked, I found this section:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
And it had this line:
<DeployIisAppPath>Default Web Site/sitenamehere</DeployIisAppPath>
I added this same line to the non-working project, changed the sitename, and it worked.
Hope this helps someone else.
You could pass this DeployIisAppPath as parameter to Jenkins, like this:
p:DeployIisAppPath=Default Web Site/sitenamehere
This would allow you to have different sitenames on different machines. While in your example (with CSPROJ modification) you would be obliged to have one IIS site name on all target machines

VS 2012 Publishing Profiles and Copy Files Using MSBuilld Commands

I've set up asp.net website on Azure with TFS online for source control using VS 2012. I'm trying to copy files using VS 2012 new publishings profiles and MSBuild. Reading this article Visual Studio 2012 Web Deployment Projects are Dead – Long Live Publishing Profiles, in which Doug says you can use build scripts in your publishing profile.
So I setup a test that works in my .csproj on my local build. I'm just simply copying the robots.txt file from the root directory to the css directory. Here is my test. I set my pubxml in the TFS Build Process template under process > 6. Publishing -- Azure Website, Web Deploy Pubish Profile.
<Target Name="AfterBuild">
<Copy SourceFiles="$(ProjectDir)robots.txt" DestinationFolder="$(ProjectDir)css\" />
</Target>
I dropped this Code into my my pubxml file and I get a big nothing. What am I doing wrong?
Is it possible to copy files afterbuild on Azure?
Additional Information
The log file contains these lines so I'm sure the publishing profile is running.
AfterBuild:
Creating directory "C:\a\src\...\css".
Copying file from "C:\a\src\...\robots.txt" to "C:\a\src\...\css\robots.txt".
Here are the build steps that Azure's default build template uses:
ValidateSolutionConfiguration:
PrepareForBuild:
CoreCompile:
_CopyFilesMarkedCopyLocal:
CopyFilesToOutputDirectory:
GenerateTargetFrameworkMonikerAttribute:
CoreCompile:
_CopyFilesMarkedCopyLocal:
CopyFilesToOutputDirectory:
_CopyWebApplicationLegacy:
ValidateGlobalPackageSetting:
CollectFilesFromIntermediateAssembly:
CollectFilesFromContent:
CollectFilesFromIntermediateSatelliteAssembliesWithTargetPath:
CollectFilesFromReference:
CollectFilesFromAllExtraReferenceFiles:
CollectFilesFrom_binDeployableAssemblies:
PipelineCollectFilesPhase:
ExcludeGeneratedDebugSymbol:
PreTransformWebConfig:
TransformWebConfigCore:
PostTransformWebConfig:
PreProfileTransformWebConfig:
PipelineTransformPhase:
ProcessPublishDatabaseSettings:
PreAutoParameterizationWebConfigConnectionStrings:
AutoParameterizationWebConfigConnectionStringsCore:
PostAutoParameterizationWebConfigConnectionStrings:
PipelineMsdeploySpecificTransformPhase:
ValidatePublishProfileSettings:
CopyAllFilesToSingleFolderForMsdeploy:
PipelineCopyAllFilesToOneFolderForMsdeploy:
Package:
GenerateMsdeployManifestFiles:
PackageUsingManifest:
GenerateSampleDeployScript:
PipelineDeployPhase:
AfterBuild:
So it looks like Azure packages all the files up during the "31. CopyAllFilesToSingleFolderForMsdeploy" step. It would appear that running copy during the AfterBuild step is to late. I moved the Copy command to the target "BeforeBuild" but the files are still not ending up in the CopyAllFilesToOneFolderForMsdeploy step.
Thanks to Sayed Ibrahim Hashimi for his article How to compress CSS/JavaScript before publish/package for helping me solve this.
It's possible to copy directly Package Temp Directory. I ended up adding this target to my publishing profile (pubxml) file. After the "CopyAllFilesTOSingleFolderForMsdeploy" step finishes this step will run which will copy a file from one part of the solution into the destinationfolder you specify.
<Target Name="AdditionalFilesForPackage" AfterTargets="CopyAllFilesToSingleFolderForMsdeploy">
<Copy SourceFiles="$(ProjectDir)robots.txt" DestinationFolder="$(_PackageTempDir)\css\" />
</Target>

RoleEnvironment initialization in Azure on IIS x64 bit throws an error

I created webservice that runs under IIS, and it is x64 bit. I deployed it with custom install script on Azure machine (ws2008 r2). I created custom app pool (64 bit, Managed pipeline mode: Classic, .net v2, with NetworkService account as service user). Everything seems to be configured correctly but when I try to run my application I get following error:
System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception. ---> System.TypeInitializationException: The type initializer for '' threw an exception. ---> .ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
I can run standalone win form application and this method works correctly. What is more when I switch app pool to 32 bit and I run my application then it fail (because it has x64 bit components), however later when switch back to x64 it works correctly, RoleEnvironment returns correct data.
Do you have any ideas what can I do wrong when it comes to configuration, so this module cannot be loaded in x64 bit version?
This may help. You can add a start-up task to your Windows Azure project's .csdef file to configure IIS to allow 32-bit modules in 64-bit applications.
In your Windows Azure project .csdef file:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition>
<WebRole ...>
...
<Startup>
<Task commandLine="ConfigureIIS.cmd" executionContext="elevated" taskType="simple" />
</Startup>
</WebRole>
</ServiceDefinition>
ConfigureIIS.cmd (all one line):
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true
I believe you would need to install VC++ x64 runtime in your Azure VM via startup task as some of the references you are using need VC++ run time.

Resources