Pode icon indicating copy to clipboard operation
Pode copied to clipboard

The property ‘ShowServerDetails’ cannot be found on this object

Open zakariakbj opened this issue 7 months ago • 2 comments

Describe the Bug

Unable to start Pode using Kestrel listener with the following exception:

InvalidOperation: PATHTOMODULE\Modules\Pode\2.1.2.1\Private\PodeServer.ps1:95 95 | $listener.ShowServerDetails = [bool]$PodeContext.Server.Security. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The property 'ShowServerDetails' cannot be found on this object. Verify that the property exists and can be set.

After few investigation seems that the issue is triggered during the New-PodeKestrelListener call

New-PodeKestrelListener: PATHTOMODULE\Modules\Pode\2.1.2.1\Private\PodeServer.ps1:90 90 | $listener = & (New-Object $PodeContext.Server.ListenerType) $PodeContext.Server.Listener | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Unable to find type [Pode.Kestrel.PodeKestrelListener]

Based on the document this is a known issue and update to .NET Framework 4.7.2 must be performed but I'm currently using .NET 4.8 on the server.

Steps To Reproduce

Trying to start Pode with the following code which is working without Kestrel:

Start-PodeServer -ConfigFile '.\server.psd1' -Threads 2 -ListenerType Kestrel {

# Attach port 8081 to the local machine address and use HTTP protocol
Add-PodeEndpoint -Name 'Pode Dev' -Address * -Port 8081 -Protocol Http

# Enable OpenAPI
Enable-PodeOpenApi -OpenApiVersion 3.1.0 -RouteFilter '/api/*' -DisableMinimalDefinitions

# Set OpenAPI metadata
Add-PodeTagInfo -Title 'Pode' -Version 1.0.0 -Description 'Pode Server'

# Set logging configuration
New-PodeLoggingMethod -Path '.\logs\pode' -File -Name 'requests' -MaxDays 7 -MaxSize 10MB -EnableRequestLogging
New-PodeLoggingMethod -Path '.\logs\pode' -File -Name 'errors' -MaxDays 7 -MaxSize 10MB -EnableErrorLogging

# Import required module
Import-PodeModule -Path '.\modules'

# Import Pode routes
Import-PodeRoutes -Path '.\routes'

# Expose OpenAPI JSON schema for Swagger
Add-PodeEndpoint -Method Get -Path '/openapi' -ScriptBlock {
    $openapi = Get-PodeOpenApi
    Get-PodeOpenApiDefinition | Write-PodeJsonResponse
}

}

Platform

OS: Windows Server 2016 Pode: v2.12.1 (same issue with 2.12.0) PS: 7.4.6 Hosting: IIS

Additional Context

.NET Framework 4.8

zakariakbj avatar May 20 '25 08:05 zakariakbj

Hey @zakariakbj,

I need to update the Pode.Kestrel's README and Pode's documentation, but basically that module only works with Pode v1.x. In Pode v2 I rewrote all the the HTTP listening, and created Pode's own socket listener in .NET - which made the Pode.Kestrel module in v2 redundant.

In Pode v1 it relied on .NET HttpListener, and was being consumed within PowerShell runspaces - so the performance wasn't too great (~100req/s). The Kestrel module gave it the upper edge at ~200req/s, as it didn't suffer all the bloat the HttpListener came with - but both still suffered a PowerShell bottleneck so they couldn't go any faster.

In Pode v2, I scrapped .NET's HttpListener, and wrote my own that didn't rely on ASP.NET. The performance was on par, if not better, than Kestrel, and the need for it wasn't necessary any more.

I left it open until a couple months ago, as I did think I might go back an update Kestrel module. But changes with how Kestrel/ASP.NET work today made it difficult to get it working at all with how it needs to interact with PowerShell.

Is there a reason you were looking to use Kestrel, or was it purely from a performance point of view? (if it's performance, it won't get any better than Pode's new internal listener)

Badgerati avatar May 28 '25 08:05 Badgerati

Hey @Badgerati !

Thank you for your response. I was indeed considering Kestrel for its potential performance benefits. However, if there are no noticeable improvements, I see no advantage in switching and will continue using the Pode 2.x listener.

zakariakbj avatar May 28 '25 13:05 zakariakbj