- Deploying ASP.NET Applications - LinkedIn
- IIS Architecture
- IIS Installation
- What Is an IIS Application Pool - GREAT ONE!
- Publish WebAPI from Visual Studio to IIS using Web Deploy
- E.g. configuration: Windows 7 + Vistual Studio + Docker for Windows CE
- Demo app from ASP.NET MVC: Building for Productivity and Maintainability - Jess Chadwick
- Demo app from Deploying ASP.NET Applications - Tiberiu Covaci
- In case of
Server Error in '/' Application
like this one belowCould not find a part of the path
...- ...
'C:\Users\mant\Downloads\Ex_Files_Deploying_ASP_NET_Apps\Exercise* Files\DemoApp\DemoApp\Website\bin\roslyn\csc.exe'.*
- Run this in Package Manager Console:
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r
- In case of
- Including ASP.NET web apps
- Collection of websites running as a single process, with a single identity ...
- ... each application pool consists of a process called
w3wp.exe
that runs on the server machine - https://stackify.com/what-is-an-iis-application-pool/
- Splitting websites over application pools allows ...
- ... more rigid security between the websites
- ... as well as preventing one website from crashing if another one does (better reliability/availability)
- Application pools are used to separate sets of IIS worker processes ...
- ... that share the same configuration and application boundaries
- Combining multiple sites into a single application pool ...
- ... is to either share resources
- ...or to leave a smaller server footprint on the server
- Client OS: e.g. Windows 7 (or newer)
- Server OS: e.g. Windows Server 2012 (or newer)
- IIS --> on client OS
- a lot of manual work
- need to install
IIS
andWeb Deploy
- IIS --> on server OS (on-premises server or Azure VM)
- still a lot of manual work
- Azure WebApp/AppService
- much less manual work
- IIS is already preinstalled behind the scenes by Microsoft (infrastracture abstracted away)
- just configure connection strings for DBs, staging areas etc.
- avoid manual patching and updating
- Docker
- Azure ACI
- Azure Container Instances
- Azure AKS
- Azure Kubernetes Service
- Azure ACI
- Start --> "Turn Windows features on or off"
- Check "Internet Information Services" checkbox - this will check only necessary sub-items
- Check .e.g. "Internet Information Services" --> "Application Development Feautres" --> ASP.NET 4.8 - if your app uses it
- Recommendation: install only necessary features for your web app and nothing more - to avoid security risks
- Check installation: open web browser and navigate to
localhost
--> you should see IIS startup page (or any test page)
- Start --> "Server Manager" --> "Add roles and features"
- Choose "Installation Type" --> "Role-based or feautre-based installation" or "Remote Desktop Service installation"
- Choose "Server Selection" --> server to install IIS on
- Choose "Server Roles" --> e.g. "Web Server (IIS)"
- Choose "Feautres" --> e.g. ".NET Framework 4.5" - if your app uses it
- Choose "Web Server Role (IIS) - Role Services" --> e.g. "Application Development - ASP.NET 4.5"
- Confirm --> Install --> Restart server
- Check installation: open web browser and navigate to
localhost
--> you should see IIS startup page (or any test page)
- https://github.com/michalantolik/powershell/blob/main/scripts/Enable-IISFeatures.ps1
- https://github.com/michalantolik/powershell/blob/main/scripts/Disable-IISFeatures.ps1
- https://github.com/michalantolik/powershell/blob/main/scripts/Get-IISFeatures.ps1
- Copy this PS script to target machine: https://github.com/michalantolik/powershell/blob/main/scripts/Install-IIS-DSC.ps1
- Navigate to folder where you it was copied with PowerShell and run the following commands:
# Load the script
. .\IIS-Install-DSC.ps1
# Compile given DSC Configuration --> this will create "DeployWebApp" folder
DeployWebApp
# Start DSC Configuration from folder where it was compiled
Start-DscConfiguration -Path .\DeployWebApp -Wait -Verbose
DeployWebApp
- Check installation: open web browser and navigate to
localhost
--> you should see IIS startup page (or any test page)
- Client-server application that works together with IIS ...
- ... and help us with the publishing of applications
- Manual
- Automatic
- Enable feature called "Management Service" in "Server Manager"
- Server Manager --> Server Roles --> Web Server (IIS) --> Management Tools --> Management Service --> ...
- ... Next --> Install
- ... to allow IIS web server to be managed remotely from another computer using IIS Manager
- Install Web Deploy application
- Go to
iis.net
webpage --> Downloads --> Deploy & Migrate --> Web Deploy 3.6 --> Install this extension
- Go to
- Copy this PS script to target machine: https://github.com/michalantolik/powershell/blob/main/scripts/WebDeploy-DSC.ps1
- Navigate to folder where you it was copied with PowerShell and run the following commands:
# Load the script
. .\WebDeploy-DSC.ps1
# Compile given DSC Configuration --> this will create "WebDeployOnly" folder
WebDeployOnly
# Start DSC Configuration from folder where it was compiled
Start-DscConfiguration -Path .\WebDeployOnly -Wait -Verbose
-
- Publish to local folder from VS --> e.g. to
C:\Deploy\FolderDeployment
- Edit
web.config
file inC:\Deploy\FolderDeployment
- e.g. replace local DB connection strings with production DB - Copy content of
C:\Deploy\FolderDeployment
folder toC:\inetpub\wwwroot
- Browse to
localhost
to test the website
- Publish to local folder from VS --> e.g. to
-
- Package the application and deploy manually (copy)
- Publish to Web Server (IIS) from VS
- Web Deploy Package
- Enter Package location
- Enter Site name - "Default Web Site" by default in IIS
- Enter production DB connection strings
- Publish
- Go to Package location and make sure that (zip + cmd + readme) + other files are there
- Deploy the pacakged application to IIS manually
- Open IIS Manager --> Deploy --> Import Application (google for it if missing) --> Select published ZIP file
- Deploy the packaged application to IIS using script (cmd)
- Open commandline in admin mode
- Go to Package location
- Run
Website.deploy.cmd /T
- to test - "what if" - Run
Website.deploy.cmd /Y
- to deploy - to local IIS - Run
Website.deploy.cmd /Y /M:remote_machine_name /U:username_and_password
- to deploy - to remote IIS
- Package the application and deploy manually (copy)
-
- Publish to Web Server (IIS) from VS
- Web Deploy
- Enter Server: "localhost" or some remote server
- Enter Site name - "Default Web Site" by default in IIS
- Enter Destination URL: "http://localhost
- Enter DB connection strings
- Save & Publish
- Destination URL should be open automatically to make sure that the process went fine
-
- Quickstart: Deploy an ASP.NET web app
- Kudu ZIP Push Deployment
- Manual, Azure Portal Kudu GUI
- Kudu ZIP Push Deployment
- Quickstart: Deploy an ASP.NET web app