How do I specify the physical path as an expression with a variable like release-n when managing a virtual application in an ADO IIS Web App Manage task?
We're just getting started with ADO Releases to IIS servers. We have IIS Web App Manage and Deployment tasks working, but only to a static physical path on the server.
I would like to store the new releases in versioned directories, and have the virtual application updated to point to the version being deployed.
For example
Default Web Site
/card-poc <-- web application stored outside of wwwroot
/release-1
/release-2
...
/release-n <-- IIS virtual application physical path is pointed to here
So in an ADO Release IIS Web App Manage task, how do I specify the physical path as an expression with a variable like release-n?
I've tried d:\IIS_VDs\CARD-poc\Release-$(rev:r)\ to get the release name, but I get the error
The given path's format is not supported.
The expected outcome is that the directory would be created, the virtual application would be altered to point to the new directory, and then the subsequent IIS Web App Deploy task would copy the files to the new dir. The goal is to allow a server operator to roll back an application to a prior version without knowledge of or access to to ADO, Version Control, or really anything except the IIS server.
I tested $(rev:r) and got the same error as you. I think the problem is getting the value of the $(rev:r) variable. I try to Write-Host "$(rev:r)" in the powershell task, but the task cannot get the value of $(rev:r). According to this ticket , it seems $(rev:r) is a special variable format that only works in the Number field in the editor.
As workaround, you can try to use Release.ReleaseName predefined variable.
Release.ReleaseName : The name of the current release. Example: Release-47
Related
My complete CICD pipeline is fine. But once the release is completed the test website is inaccessible reason why. In IIS under Basic settings the physical path changes automatically. After every release i have to manually set so iis serves where the contents of release are. Am i missing something in IIS configuration.
***The blacked out is the folder path. After every release it resets to C:\inetpub\wwwroot
Help please this is the only thing that frustrating me. Thanks in advance
Azure release set up webpage error IIS Physical path
After every release it resets to C:\inetpub\wwwroot
The root cause of this issue is the settings(Physical path) in the IIS web app manage task.
This task is used to configure the IIS website. If you set its value to %SystemDrive%\inetpub\wwwroot, it will reset the value to C:\inetpub\wwwroot every time you run release.
To solve this issue, you can change the physical path to the value you expect.
For example:
Here is the doc about IIS web app manage task.
I have a web application project in VS2012 which I'm publishing using a "Web Deploy Package". I want this package to include app-pool settings, specifically creating an IIS app-pool and assigning the newly created application to it.
I'm familiar with the option "Include application pool settings used by this Web project" available when the project is configured to use an IIS instance (not IIS Express), but IIS configuration is not part of the project file, and thus not source controlled. What happens when somebody builds a deployment package on a machine that hasn't had IIS meticulously configured? Not ideal.
How else then, can I go about getting AppPool settings into my web deploy package? I understand that the appPoolConfig provider is IIS7+ only, I'm fine with that limitation. I've banged my head against this issue in the past and never found a solution. 18 months later, we've got a new VisualStudio version, and a new web-publishing-pipeline, are there new options to address this? Or maybe something I missed when I first tackled this problem?
Edit
OK, I'm seeing the following as options:
Configure my project to sync settings from an IIS instance. As mentioned, I'm not a fan of this given that it puts settings outside of the project, meaning the environment has to be meticulously configured to build + publish. Plus it drags along other IIS settings I don't want included.
Inject something into the web-publishing-pipeline (WPP) to modify the archive.xml. I've toyed with this in the past and had limited success. One problem is the pipeline isn't exactly co-operative with working directly on the archive.xml file, another problem is some of the more cryptic attributes involved, like MSDeploy.MSDeployProviderOptions which appears to have some Base64 encoded binary? No idea what to put in there.
Find an existing "provider" that can do what I want. I might be out of luck here, the appPoolConfig provider only seems to want to read / write IIS, not, say, an XML file of settings. Does anybody know otherwise?
Write my own "provider" to produce manifest output entries. I'm not sure, is it possible to write a custom provider that writes to a manifest using the name of an existing provider? As in, MyCustomPoolProvider writes appPoolConfig sections into a manifest? This sounds like a potentially painful exercise that may or may not work. Would I still need to figure out the encoding of whatever is going into MSDeploy.MSDeployProviderOptions?
I get the feeling that the fundamental obstacle with Web Deploy for what I'm trying to accomplish, is how strictly it leans on "providers". The pre-existing providers are largely designed for IIS synchronisation, not primary development and publication. It so happens that some of these providers can be relatively easily hooked into via MSBuild, but the majority insist on pulling data from IIS, and that's that.
You are correct in your understanding of the appPoolConfig provider, in that it can only sync between App Pools and can't be provided with the configuration directly. What you could potentially do is keep a copy of the appPool in question in package form (ie. msdeploy -verb:sync -source:appPoolConfig=PoolName -dest:package=apppool.zip) and attempt to hijack the pipeline so that the MSDeploy call adds the application content into the package, leaving the existing content there.
Alternatively, you could always keep the packages separate and deploy them with different calls to MSDeploy.
FYI, MSDeploy.MSDeployProviderOptions is simply an encoded version of the parameters supplied to the provider when it was packaged. For example, -source:dirPath=c:\,ignoreErrors=0x10293847 -dest:package=package.zip would package the ignoreErrors value.
A couple of days ago, Microsoft released the engine they're using to do git deployments to Azure. I've had a task on my TODO list for a while to get that kind of functionality set up on my DEV IIS server, so I'm interested in trying out Kudu for that purpose.
The "Getting Started" document shows how to run the web front-end, but everything in there uses "http://localhost:PORTNUMBER" type URL's for git repositories, site URL's, etc.
I realize this is probably getting too far ahead of them, but I'm wondering if anyone has pointers for how to set it up using real domains on "regular" IIS instead of all of the localhost bits?
This is an old question, so I'm giving an updated answer with more current info since I just worked through setting up Kudu on an internal deployment server. The currently selected answer only deals with if you are directly running Kudu from within a development environment.
If you are deploying to a "production" type environment and don't want to install Visual Studio on the target server, there is a good guide on the project website on github.
https://github.com/projectkudu/kudu/wiki/Deploying-to-a-server
On the target server, you will need to install:
MSBuild ( http://go.microsoft.com/fwlink/?LinkId=309745 ) - comes with Visual Studio
NodeJS ( http://nodejs.org )
Git ( http://git-scm.com/downloads )
Back on your development machine, clone the git repo and build using the "build.cmd" file, following instructions in the above link.
In running build.cmd I got several test failures which blocked the build from producing artifacts. These were all related to Mercurial, which we don't use. Installing a Mercurial client didn't make them magically go away, so I disabled the tests rather than sink a bunch of time into debugging my environment.
Your build output will indicate the failures. I disabled by commenting out the [Fact] attribute.
These are the tests I disabled:
tests/Kudu.Core.Test/HgRepositoryFacts.cs (all tests)
Once you have a successful build that has created all the items in the artifacts you can move to deploying the Kudu website and web service code. The below instructions are for setting up a distinct web application instance, rather than dumping everything in c:\inetpub\wwwroot, which is how the instructions read.
Copy "artifacts\Release\KuduWeb" to the target area on the server where your website will run from. I run my kudu install with a separate host header, but you could as easily use a separate port or run as the root website. This directory will be the root for your web application.
Create an empty "App_Data" folder immediately under the KuduWeb folder.
Copy "artifacts\Release\SiteExtensions\Kudu" to the same level as the folder in step 1 and rename to "Kudu.Services.Web". This location is set as a relative path in the KuduWeb web.config file - setting serviceSitePath.
Open IIS Admin and create a website pointing to the "KuduWeb" folder from step 1.
Configure the app pool from step 4 to run as "LocalSystem". This is required to manage IIS Sites.
Create a new folder "apps" at the same level as KuduWeb. This is where deployments will be sent. Note: this location is controlled in the KuduWeb web.config file - setting "sitesPath"
Change filesystem permissions to grant "Users" full access to the "apps" folder created in the above step.
On starting my Kudu website, I got the following error.
Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
For some reason it didn't copy the appropriate MVC version into the deployment artifacts.
If you hit this error, the MVC 5 file can be obtained via NuGet. I found that my source code was built against 5.1.0, so this is the appropriate link:
https://www.nuget.org/packages/Microsoft.AspNet.Mvc/5.1.0
In order to extract the dll, I set up a new dummy project and used NuGet to pull down the dll via the package manager console.
Install-Package Microsoft.AspNet.Mvc -Version 5.1.0
Once you get the binary, copy it from package directory ( .\packages\Microsoft.AspNet.Mvc.5.1.0\lib\net45\System.Web.Mvc.dll ) to the website bin directory on the target machine.
At this point you are up and running. Use the web interface to create your application. It will create a subfolder under the "apps" directory with a tree that should be self explanatory. It will also have created two new websites for your application:
kudu_{your-app-name}
kudu_service_{your-app-name}
In a production situation, you should create an additional website running on appropriate port/host header that points to: .\apps\\site\wwwroot
Now you can add a git remote for your deployment. Go to your source location in a git console (ex: Git Bash) and add the remote as identified by Kudu. Note: you may need to change localhost in the url to be the appropriate server name.
git remote add deploy http://:52711/your-app-name.git
Push your code to the new "deploy" remote and see what happens. You should see all the normal push messages, plus the build output.
git push deploy master
My initial push failed to build and deploy due to "node" not being recognized. It was in the path, so a server reset convinced the path environment variable to be refreshed. You may find additional errors to work through. For instance, I had an issue with MSBuild being imported and causing a hiccup.
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Visual Studio\v11.0\WebApplications\Microsoft.WebApplication.targets" was not found.
YMMV, but these are all solvable problems now. Good continuous deploying!
The project automatically sets up two websites on IIS for each application you add using the web front end. Kudu doesn't automatically map the bindings for them but it's relatively easy to open IIS and find the two sites named "kudu_appname" and "kudu_appname_service". The service website is the one that you point GIT too and the other one is the site itself. Just add public bindings to them by right-clicking and "edit bindings". You can then add public hostnames to them.
This is the easy part. The hard part that I'm still working on is getting authentication working so any random Joe isn't able to push to my kudu repository!
Does MS Deploy support the following scenario?
Create a package from a Team Build drop
Install the web application into IIS6/7 including app pools, settings, etc.
It doesn't seem to want to let me configure IIS on the destination server if my package wasn't created from IIS originally.
If you pass the parameter DeployOnBuild set to true, then your build will produce not only your normal web site files under _PublishedWebSites, but also one whose name ends with _Package. That will contain your package, the parameters file and the manifest, plus a .cmd file for deploying the package.
What it will not contain is anything you didn't tell MSBUILD to place into the package. In particular, no, it won't contain IIS settings unless you told MSBUILD to place IIS settings there. It won't get the settings from out of the air - it will only get them from your local IIS, and only if that's where you have your project set up.
The current feature set does not support this scenario - Microsoft
As I deploy my web site, I found that I could convert a folder into a virtual folder or web application, I am totally confused about these 2 concepts.
Why there are two different types?
What's the purpose of each?
A Virtual Folder or Virtual Directory is just a link to a physical folder somewhere on the server. This folder becomes part of the website structure and you can use the virtual directory in the path part of URLs. Code that executes in Virtual Directories will execute in the same "Application" as it's parent.
An Application is where the code that runs inside that "folder" has it's own Session state and Application state. It is in effect a new standalone application living underneath the root application.
For example, if you were to deploy an ASP.NET application into a site that had an Application folder called /myapp then that application would have it's own application domain, session state, application state completely separate from another ASP.NET application running in /. For example: if you set an Application value Application["Thing"] = 123 in the root application and then did the same but with a different value in /myapp then Application["Thing"] in the root would not be overwritten by the assignment in /myapp.
Another thing you can do with Application's is specify a different Application Pool to run under. For example your root / application might contain an ASP.NET 2.0 application and run in a pool configured for .NET 2.0. However you may want to run a blog or forum application written in ASP.NET 4.0. Now because you can't mix ASP.NET runtime versions in the same application pool, you can specify an alternative application pool specifically for ASP.NET 4.0 applications.
Applications can also behave like Virtual Directories and you can point an application folder at a physical folder elsewhere on the server.
If you're interested in the underlying mechanics of Virtual Directories and Applications on IIS7 then have a look at this answer I posted a while back:
Using ServerManager to create Application within Application
To add an informational detail to what Kev has very nicely mentioned - All virtual directories by default run under a pre-defined app pool named DefaultAppPool. DefaultAppPool comes by default with IIS whenever you enable this feature in windows. For WebApps you can always create fresh/new appPools and run your webApp inside your newly created appPool. These appPools provide you that physical/separate process space (in form of worker processes) with the help of which IIS is able to provide services like sessions state, application state etc in silos to a webApp when it has its own appPool defined. Whenever your webApp's appPool crashes, the other webApps (using their own custom appPool) or virtual directories (using DefaultAppPool appPool) remain completely unaffected.