IIS
To run a dashboard in IIS, you will need to configure an application pool and website just as you would with any other IIS web application.
In addition to the standard IIS configuration, you will need the following.
OS limitations
It's important to note the difference between client OS and server OS:
Client OS: have a max on concurrent connections, as it's limited to 10 max.
Server OS: have no limitation. (except standard defined by IIS)
Configuring a site for Universal Dashboard
To host a Universal Dashboard website, you'll want to install the UniversalDashboard module to a location that the ApplicationPool user has access to. The default application pool user will not be able to access anything outside of wwwroot. You will need to either install Universal Dashboard to that location or provide additional access to an alternate folder for that user.
The recommended approach is provide a location on the $Env:PSModulePath
that enables the user to load modules from. For example, you could have all your modules stored in C:\PowerShellModules\
and then you would add that path to the $Env:PSModulePath
environment variable. If you configure it in this manner, you'll be able to upgrade Universal Dashboard in a single place and all your websites will load the new module.
Once you have the UniversalDashboard module installed, you will need copy the web.config
file included with UD as well as your script to the websites folder. You can click Explore to view this folder.
The web.config
file should start PowerShell.exe or Pwsh.exe. As an argument to the process, you'll want to include the dashboard script. Edit the aspNetCore
node in the web.config
file to include this information.
Create a .ps1
file and place it in the wwwroot
folder. The dashboard should contain a dashboard definition and a call to Start-UDDashboard
with the -Wait
parameter specified.
Your website directory should now contain a web.config
file and a PowerShell script that will execute when accessing the website.
Navigate to the IIS website in your browser and you should see Universal Dashboard running.
Creating Nested IIS Sites
Requires Universal Dashboard 2.3 or later
To create a nested IIS site, follow the same steps as above but nest your UD site beneath another site. You will have to make one change to the UD installation in this type of configuration. Within the UD folder, find the index.html
file in the client
folder.
Within this file, change the base
's href
attribute to match the relative URL of your UD installation. If you wanted to have the URL resolve to http://myServer:8080/dashboards/dashboard
you would set the value of the href
attribute to /dashboards/dashboard/
.
For the URL of the two script files, you will need to remove the preceding /
.
An example index.html
looks like this.
Licensing
The license should be named license.lic and placed in the net472
or the netstandard2.0
folder within the module installation directory. This will ensure that the license is persistent throughout restarts.
Troubleshooting
Check the Application Log in the Event Viewer for .NET runtime errors. You can also run your script from the command line to view errors that may be present when starting the dashboard that may be preventing it from loading in IIS.
Some other tips from the community:
Build Verbose Logging Into your solution
Build Verbose Error Logging AND handling into your solution
Ensure that your final syntax is correct. There are some nuances that yield different results when running as a script vs interactively.
Logging
You can enable logging by specifying a path in the web.config
file. You can change the stdoutLogFile
path to a location that IIS has the permissions to write to. You can then add Enable-UDLogging
to the top of your dashboard.ps1
file to turn on console logging for Universal Dashboard. This is a complete web.config
example
Log files will then be written and timestamped to the directory and name you select.
Last updated