解析器错误消息:ID1024:配置属性值无效。物业名称:“ serviceCertificate”

时间:2019-01-15 16:55:33

标签: windows docker application-pool

Parser Error Message: ID1024:我在.net 4.7和https中有一个应用程序。在图像中运行复制时,出现以下错误:

 Parser Error Message: ID1024: The configuration property value is not valid.
Property name: 'serviceCertificate'
Error: 'ID1039: The certificate's private key could not be accessed. Ensure the access control list (ACL) on the certificate's private key grants access to the application pool user.
Thumbprint: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx''


DOCKER FILE
FROM microsoft/aspnet:4.7.2-windowsservercore-1803
ARG site_root=.
ADD ${site_root} /inetpub/wwwroot

EXPOSE 443

#Set the CERT_PASS with the password of your PFX certificate
ENV CERT_PASS 3889878999H#

#Eventually modify the path of your Powershell script
RUN ["powershell", "C:/inetpub/wwwroot/ssl.ps1"]

ssl.ps1

$securePfxPass = [Environment]::GetEnvironmentVariable("CERT_PASS") | ConvertTo-SecureString -AsPlainText -Force
Import-PfxCertificate -Password $securePfxPass -CertStoreLocation Cert:\LocalMachine\My -FilePath c:\inetpub\wwwroot\service.nextway.corp.v3.pfx  

$pfxThumbprint = (Get-PfxData -FilePath c:\inetpub\wwwroot\service.nextway.corp.v3.pfx -Password $securePfxPass).EndEntityCertificates.Thumbprint


$binding = New-WebBinding -Name "SSO" -Protocol https -IPAddress * -Port 443 ;
$binding = Get-WebBinding -Name "SSO" -Protocol https;
$binding.AddSslCertificate($pfxThumbprint, "my");

#You should remove both the PFX password from the Environment Variable and the .pfx file
[Environment]::SetEnvironmentVariable("CERT_PASS",$null)

1 个答案:

答案 0 :(得分:1)

在我们的环境中,这是一个ADFS和指纹问题,通常是由不正确的证书指纹引起的。 安装程序手动将指纹粘贴到使用的Web应用程序的web.config文件中。 粘贴时,还会在文本之前或之后粘贴一个秘密或隐藏的字符,但看不见,从而导致ID1024或ID1039。 找到一种方法来确保将指纹插入到web.config中,可以避免从Word或记事本粘贴时出现的秘密字符或隐藏字符。