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?
Tips til problemløsning
Når vi opplever problemer rundt tilkobling, og får feil som f.eks:
Finnes det noen enkle former for problemløsningsmetoder som kan rydde vekk støy fra dotnet klienten?
Lagde et powershell skript:
Når en kjører denne får vi bare feil, hadde forventet 200 med innhold (med NoChanges):
Noen andre metoder for å enkelt kunne etablere problemer rundt brannmur,proxy,sertifikat, osv?