Configuring VSTS
https://docs.microsoft.com/en-us/vsts/build-release/apps/aspnet/build-aspnet-core?tabs=vsts
What follows can essentially be sourced from the link below: https://docs.microsoft.com/en-us/vsts/build-release/apps/cd/deploy-webdeploy-iis-deploygroups
.NET Core 2.0 https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x 2008R2
- Ensure .NET45 is installed: https://www.microsoft.com/en-au/download/details.aspx?id=42642
- Ensure PowerShell 3.0 or later is installed: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell?view=powershell-5.1
- Server Manager => Add Roles => Web Server
- Tick ASP.NET => Install
# Install the .NET Core SDK
Invoke-WebRequest https://go.microsoft.com/fwlink/?linkid=848827 -outfile $env:temp\dotnet-dev-win-x64.1.0.4.exe
Start-Process $env:temp\dotnet-dev-win-x64.1.0.4.exe -ArgumentList '/quiet' -Wait
# Install the .NET Core Windows Server Hosting bundle
Invoke-WebRequest https://aka.ms/dotnetcore-2-windowshosting -outfile $env:temp\DotNetCore.WindowsHosting.exe
Start-Process $env:temp\DotNetCore.WindowsHosting.exe -ArgumentList '/quiet' -Wait
# Restart the web server so that system PATH updates take effect
net stop was /y
net start w3svc2012+
# Install IIS
Install-WindowsFeature Web-Server,Web-Asp-Net45,NET-Framework-Features
# Install the .NET Core SDK
Invoke-WebRequest https://go.microsoft.com/fwlink/?linkid=848827 -outfile $env:temp\dotnet-dev-win-x64.1.0.4.exe
Start-Process $env:temp\dotnet-dev-win-x64.1.0.4.exe -ArgumentList '/quiet' -Wait
# Install the .NET Core Windows Server Hosting bundle
Invoke-WebRequest https://aka.ms/dotnetcore-2-windowshosting -outfile $env:temp\DotNetCore.WindowsHosting.exe
Start-Process $env:temp\DotNetCore.WindowsHosting.exe -ArgumentList '/quiet' -Wait
# Restart the web server so that system PATH updates take effect
net stop was /y
net start w3svcThere should be 1 Deployment group created per Environment
- VSTS => 'Build & Release' => 'Deployment Groups'
- Add/New name
- Configure:
- Name: Dev => Create
- Register Machines:
- Type of Machine: Windows
- Use a personal access token in the script for authentication => Copy script to clipboard
- Note the environment requires PowerShell 3.0 or higher: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell?view=powershell-5.1
- Did you want multiple agents for the same project installed on the same server? => Edit the script copied from the clipboard and ensure the following 6.1 Ensure the default path is changed from $env:SystemDrive'vstsagent' to something else eg. $env:SystemDrive'vstsagent-dev' (this will appear multiple times) 6.2 Ensure the agent name is different. ie --agent "$env:COMPUTERNAME" to --agent "$env:COMPUTERNAME-DEV"
- Target Environment => In an Administrator PowerShell session: Execute the script
- Enter deployment group tags for agent? => Enter
- Enter User account to use for the service? => Enter
- Validate: VSTS => 'Build & Release' => 'Deployment Groups' => 'Targets'
Information relating to configuring the app pool can be found here: https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
After a successful build
- VSTS => 'Build & Release' => 'Build Definitions' => Select the definition
- Summary => 'Recently Completed' => click on the version #
- Wait... => 'Release'
- Templates => 'IIS Website Deployment'
- Configure:
- IIS Deployment => Deployment Group: Dev
- IIS Web App Manage => Configure as per link above
- Pipeline => rename the environment to match the Deployment Group
- Add other environments, rinse repeat
- "The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80090020) https://support.microsoft.com/en-us/help/973094/error-0x80070020-when-you-try-to-start-a-web-site-in-iis-7-0 (another process is using the port)
netsh http url show uracl