Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips til problemløsning #396

Open
talisker77 opened this issue Sep 15, 2022 · 0 comments
Open

Tips til problemløsning #396

talisker77 opened this issue Sep 15, 2022 · 0 comments

Comments

@talisker77
Copy link

Tips til problemløsning

Når vi opplever problemer rundt tilkobling, og får feil som f.eks:

  • System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
    ---> System.IO.IOException: Cannot determine the frame size or a corrupted frame was received.
  • "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."

Finnes det noen enkle former for problemløsningsmetoder som kan rydde vekk støy fra dotnet klienten?

Lagde et powershell skript:

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
[System.Net.ServicePointManager]::Expect100Continue=$true
[System.Net.ServicePointManager]::SecurityProtocol=[System.Net.SecurityProtocolType]::Tls12
#invoke-get-status.ps1
$orgNummer = "orgnr" #org nummer
$queueName = "kø-navn" 
$isProd = $false # $true/$false
if ($isProd) {
    $baseUrl = "https://api.signering.posten.no"
}
else {
    $baseUrl = "https://api.difitest.signering.posten.no"
}

$requestUrl = "$($baseUrl)/api/$($orgNummer)/portal/signature-jobs?polling_queue=$($queueName)"

write-host $requestUrl
$thumb = 'thumb lagret i store'
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store([System.Security.Cryptography.X509Certificates.StoreName]::My, [System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine)
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadOnly);
$cert = $store.Certificates.Find([System.Security.Cryptography.X509Certificates.X509FindType]::FindByThumbprint, $thumb, $false)
$store.Close()
Write-Host $cert[0]
#$response = 
$headers = @{
    'Accept' = 'application/xml'
}
try {
    Invoke-RestMethod -Uri $requestUrl -Certificate $cert[0] -Method Get -Headers $headers #-Proxy 'http://localhost:8888'
}
catch {
    # Dig into the exception to get the Response details.
    # Note that value__ is not a typo.
    Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ 
    Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription

    Write-Host "InnerException.Message:" $_.Exception.InnerException.Message
    Write-Host "InnerException.InnerException.Message:" $_.Exception.InnerException.InnerException.Message
}
#Write-Host ($response | ConvertTo-Json -Depth 10)

Når en kjører denne får vi bare feil, hadde forventet 200 med innhold (med NoChanges):

InnerException.Message: Authentication failed, see inner exception.
InnerException.InnerException.Message: The credentials supplied to the package were not recognized

Noen andre metoder for å enkelt kunne etablere problemer rundt brannmur,proxy,sertifikat, osv?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant