Hello,
I have a dashboard that runs under IIS. Recently, I wanted to add a Rest API. My tests work fine locally but once on the IIS server, my Rest API doesn’t work and even my dashboard becomes inaccessible.
Are there any particular settings to be made on IIS?
Here is my IIS log :
Name Port Running DashboardService
---- ---- ------- ----------------
Dashboard 80 True UniversalDashboard.Services.DashboardService
Start-UDRestApi : Failed to bind to address http://127.0.0.1:41171: address already in use.
Au caractŠre C:\inetpub\wwwroot\dashboard.ps1:291 : 2
+ Start-UDRestApi -Name "Dashboard API" -Endpoint $ApiEndpoints -Ht ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Start-UDRestApi], IOException
+ FullyQualifiedErrorId : System.IO.IOException,UniversalDashboard.Cmdlets.StartRestApiCommand
Application is shutting down...
And my dashboard.ps1 :
...SOME CODE...
$ApiEndpoints = Get-ChildItem (Join-Path $Cache:RootFolder 'api') -Recurse -File | ForEach-Object
{
& $_.FullName
}
...SOME CODE...
$Dashboard = New-UDDashboard -Title "Dashboard" `
-EndpointInitialization $EndpointInit `
-LoginPage $LoginPage `
-Navigation $Navigation `
-Footer $Footer `
-Pages $Pages `
-Theme $Theme `
-AdminModeAuthorizationPolicy "Admin Mode"
Start-UDDashboard -Name "Dashboard" -Dashboard $Dashboard -Endpoint $Endpoints -HttpsPort 443 -AdminMode -AutoReload -Certificate $Cert
Start-UDRestApi -Name "Dashboard API" -Endpoint $ApiEndpoints -HttpsPort 10002 -Certificate $Cert -Wait
}
And a part of my Endpoint :
New-UDEndpoint -Url "/check-computercompliance" -Method "POST" -Endpoint {
param(
$Hostname,
$Username,
$Domain,
#$BitlockerId,
$Antivirus = $false,
$NDESCertificate = $false
)
...SOME CODE...
$Success = $IsLAPSEnabled + $IsMemberOfBitlockerADGroup + $IsMemberOfFirewallADGroup + $IsMemberOfMfaADGroup + !($ExceptionMessage.Count)
$Response = @{
Hostname = $Hostname
Username = $Username
IsAntivirusPresent = $Antivirus
IsBitlockerKeyInAD = $IsBitlockerKeyInAD
IsLAPSEnabled = $IsLAPSEnabled
IsMemberOfBitlockerADGroup = $IsMemberOfBitlockerADGroup
IsMemberOfFirewallADGroup = $IsMemberOfFirewallADGroup
IsMemberOfMfaADGroup = $IsMemberOfMfaADGroup
IsNDESCertificate = $NDESCertificate
HtmlExceptionMessage = $HtmlExceptionMessage
Success = $Success
}
ConvertTo-Json -InputObject $Response
}
I tried Start-UDRestApi with or without the -Wait parameter, in http and https. I don’t see what’s stuck …
Thanks for your help