我正在尝试使用 IISWebAppManagementOnMachineGroup@0 任务通过 Azure Pipelines 将 dotnet Web 应用程序部署到 Windows Server 2022。
- task: IISWebAppManagementOnMachineGroup@0
inputs:
IISDeploymentType: 'IISWebsite'
ActionIISWebsite: 'CreateOrUpdateWebsite'
WebsiteName: '${{ parameters.websiteName }}'
WebsitePhysicalPath: '${{ parameters.physicalPath }}'
WebsitePhysicalPathAuth: 'WebsiteUserPassThrough'
CreateOrUpdateAppPoolForWebsite: true
AppPoolNameForWebsite: '${{ parameters.websitePoolName }}'
DotNetVersionForWebsite: 'No Managed Code'
PipeLineModeForWebsite: 'Integrated'
AppPoolIdentityForWebsite: 'ApplicationPoolIdentity'
AddBinding: true
Bindings: |
{
bindings:[
{
"protocol":"https",
"ipAddress":"All Unassigned",
"hostname":"${{ parameters.hostname }}",
"port":"443",
"sslThumbprint":"${{ parameters.sslThumbprint }}",
"sniFlag":true
}
]
}
ServerNameIndication: true
ConfigureAuthenticationForWebsite : true
AnonymousAuthenticationForWebsite: false
WindowsAuthenticationForWebsite: true
我第一次部署工作得很好,但下一次部署出现了这个错误:
SSL Certificate add failed, Error: 183
Cannot create a file when that file already exists.
我找到了一个解决方法,通过删除 ssl 证书来完成之前的任务,如下所示:
- task: PowerShell@2
displayName: Remove ssl certs
continueOnError: true
inputs:
targetType: 'inline'
script: |
netsh http delete sslcert hostnameport=${{ parameters.hostname}}:443
有没有更好的解决方案来允许多个部署而不需要每次都删除 ssl 证书。