Did I miss a change to IIS deployment?

Hi all,

I updated to UD 2.8.2 and somehow broke my dashboard. I was just getting the loading cube and nothing else, with

[Error] Microsoft.AspNetCore.Server.Kestrel Connection id “0HLT3RSR872UR”, Request id “0HLT3RSR872UR:00000007”: An unhandled exception was thrown by the application.

in the logs. So I thought I’d re-check the documentation to see if I overwrote something. Looking at https://docs.universaldashboard.io/webserver/running-dashboards/iis it seems to be different from when I first went over to IIS a few months ago.

Old:
<aspNetCore processPath=".\net472\universaldashboard.server.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile="C:\LogFiles\stdout" forwardWindowsAuthToken="false" />

New:
<aspNetCore processPath="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" arguments=".\dashboard.ps1" />

You can see the difference in the example at the top and bottom of the linked page.

I’ve got it working the ‘new’ way now and not sure if it’s placebo, but pages seem to load faster. Just wondered if I missed something?

2 Likes

The new way was the result of some discussion on another forum post where other users got it working this way to allow for hosting in pwsh.exe. It also it a lot simpler since you don’t need to copy so much around. The UD code for this hosting didn’t change at all, just the recommended configuration.

I’m not sure why it would be faster but that’s good news :wink:

1 Like

Second the “faster” part,
Noticable difference on certain parts!

Ahha! At least I’m not going mad :smiley:

How does this change impact utilizing Windows Auth with the forwardWindowsAuthToken="true" option set on that same line within web.config?

It will still work

Windows auth is working but I have noticed that my AdminModeAuthorizationPolicy does not seem to work any more.

$AdminPolicy = New-UDAuthorizationPolicy -Name 'Admin' -Endpoint {
    param($user)
    $User.Identity.Name -eq 'UK\harmanp'
}
$Auth = New-UDAuthenticationMethod -Windows
$LoginPage = New-UDLoginPage -AuthenticationMethod @($Auth) -PassThru -AuthorizationPolicy @($ITPolicy, $AdminPolicy)
$DashboardParams = @{
    Title                  = $ConfigurationFile.dashboard.title
    Theme                  = $SampleTheme
    Pages                  = $Pages
    EndpointInitialization = $Initialization
    LoginPage              = $LoginPage
    AdminModeAuthorizationPolicy = 'Admin'
}
Start-UDDashboard  -Dashboard $MyDashboard -Name $ConfigurationFile.dashboard.title -Endpoint $endpoint -Wait -AdminMode -AllowHttpForLogin

Interesting. There isn’t any difference in terms of how the dashboard is starting so I’m surprised that this is the case. I’ll have to fiddle with it.

Is anyone else able to reproduce my issue with the admin mode auth policy?

Hi @Alc
Could you check your logs?
It could be related to the auth-policy itself.

If so, do a convertto-json on the $User into a text file and analyze the stuff, validate that there is a single “Identity.Name”.

$Usable = $User.Identity.Name | Select-Object -first 1
$Usable -eq "UK\harmanp"

Give that one a go.

Try using

$User -eq “UK\harmanp”

cause i just tried with $User.Identity.Name and got an empty response but $User gave me what it seems like you are comparing against:

No luck I’m afraid.

I thought… I know i’ll try running the dashboard.ps1 file in powershell directly rather than via IIS. So I removed -wait, shut down IIS but I just get

16:56:15 [Error] Microsoft.AspNetCore.Server.Kestrel Connection id “0HLT9I5T7BURR”, Request id “0HLT9I5T7BURR:00000002”: An unhandled exception was thrown by the application.

Not sure if I’ve missed something else?

As I say, adminmode was working fine before updating/switching to the new IIS mode.

Can you try to set forwardWindowsAuthToken to true?

<aspNetCore processPath="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" arguments=".\dashboard.ps1" forwardWindowsAuthToken="true" />

Hi adam, yes it is already set to true

<aspNetCore processPath="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" arguments=".\dashboard.ps1" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="true" />

Ok. What happens when you just return true from the auth policy?

$AdminPolicy = New-UDAuthorizationPolicy -Name 'Admin' -Endpoint {
    param($user)
$true
}

Omg, I found it! Something in the theme is stopping the options from being displayed. If I comment out my theme then they appear

image

After finding this I initially thought maybe they are just black on black, but they do not seem to be there at all.

Any ideas what it could be in the theme?

Which theme are you using?

I’ve uploaded it here

https://floobits.com/PoshCode/PowerShell.Slack.com/file/theme.ps1

Try Changing:

    ".ud-navbar" = @{
        'width'    = "100%"
        'position' = "fixed"
        'z-index'  = "9999"
    }

to

    ".ud-navbar" = @{
        'z-index'  = "9999"
    }

That did it, thank you :slight_smile:

1 Like