As @adam already described, the easiest way is to install the UniversalDashboard module for the user that is running your apppool.
Let’s call him uduser
for now.
Then you log in with user uduser
per RDP OR open a powershell window as different user (uduser
) and install the UniversalDashboard Module with install-module UniversalDashboard.Community -AcceptLicense -Confirm:$false -Scope CurrentUser -Verbose
.
After that you can copy over the included web.config to your iis or a custom web.config as, f.e. described here. After that you do not need to import the UniversalDashboard.Community module because it will be automatically imported.
Also make sure to specify the -Wait
parameter in Start-UDDashboard
, you will also get an 502.5 Internal Server Error if the switch was not given.
Keep in mind: If you are using the Cache
Scope ($Cache:…) in your dashboard.ps1 BEFORE using any UD cmdlet (so the module is not imported) you will get errors. Then you need to import the module first or one of the UD cmdlets first.
EDIT:
My best way to identify IIS + UD problems is to activate the logging in the web.config to a folder inside your website location (so you have easy access to it). You could also integrate a small html5 log viewer and view the logs inside the browser (@adam Could be a possible integration into UD (Admin Page) in the future ;-)?)
Example:
<aspNetCore processPath="C:\Program Files\PowerShell\7\pwsh.exe" arguments=".\dashboard.ps1" stdoutLogEnabled="true" stdoutLogFile=".\logs\\stdout" forwardWindowsAuthToken="true" requestTimeout="09:00:00" />
If your web.config is located in C:\inetpub\wwwroot\web.config
the logs folder with the stdout file is then located in C:\inetpub\wwwroot\logs\stdout
. Everything ud will log during startup of IIS (stdout) will be logged to this file (also some information that the UD internal logging will not show up). The file name will also include the process id and current startup date. -Wait
is a Requirement for that to work.
Example:
The default location for the stdout logfile is stdoutLogFile="\\?\%home%\LogFiles\stdout"
. %home%
is your user home directory. So if your user is called uduser
it’s located in C:\users\uduser\LogFiles\stdout
.