5 - Best Practices and Troubleshooting
- Best Practices
In this topic will we cover some of the Best Practices for IIS deployments using Harness, and some of the steps you can take to troubleshoot issues.
- Best Practices
- Next Steps
When modifying the default scripts, it is better to test test your scripts on a Windows instance using PowerShell_ise than deploying your workflow multiple times.
Using Tags for Instances
When configuring the Infrastructure Definition/Service Infrastructure in Environment, instance Tags make identifying your instances easier. Assign the same tag to all instances and simply use that tag.
Installing IIS from the Command Line
Before deploying the IIS website, application, or virtual directory to your Windows instances, there must be at least an existing IIS Web Server Role on the instance.
The following script will prepare your Windows instance with the necessary IIS set up:
Start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-Security;IIS-RequestFiltering;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;IIS-ManagementConsole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
You will see IIS installed in the Server Manager.
In the IIS listing, in ROLES and FEATURES, you can see the Web Server Role:
For more information, see Installing IIS 7.0 from the Command Line from Microsoft.
The following problems can occur when deploying your IIS website, application, or virtual directory.
Error: No delegates could reach the resource
You receive this error when deploying your workflow.
- Ensure your artifact can be deployed via WinRM onto a Windows instance. It's possible to select the wrong artifact in Service.
- Ensure you have access to the deployment environment, such as VPC, subnet, etc.
- Ensure your WinRM Connection can connect to your instances, and that your instances have the correct ports open. See Set Up WinRM on Instances and Network.
Do not target the same port as another website. In service, in Create Website, ensure $SitePort=80 points to a port that isn't in use. In the following example, the port was changed to 8080 to avoid the error:
You can keep the same port and use host header names to host multiple IIS sites using the same port. For more information, see How To Use Host Header Names to Configure Multiple Web Sites in Internet Information Services 5.0. This article is about an old version of IIS, but the same concepts apply.
Now that you have a working deployment, you can use the Harness Continuous Verification machine learning to verify and improve your deployments. For more information, see Continuous Verification.
Enhance your IIS deployment workflow(s) with the multiple options available, including Failure Strategy, Rollback Steps, Barriers, and templating. For more information, see Add a Workflow.