我正在尝试为
分配一个'Never'值我正在尝试将ExtendedProtectionPolicy.PolicyEnforcement = Never
分配给我的binding
对象但我收到错误:
Error 1 Property 'PolicyEnforcement' is 'ReadOnly'.
对象声明:
Dim binding As New WSHttpBinding()
binding.Name = "WSHttpBinding_ITest"
binding.ReaderQuotas.MaxStringContentLength = 10240
binding.ReliableSession.Enabled = True
binding.Security.Mode = SecurityMode.None
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None
'Error below binding.Security.Transport.ExtendedProtectionPolicy.PolicyEnforcement = System.Security.Authentication.ExtendedProtection.PolicyEnforcement.Never
有关如何为其分配“从不”值的任何想法吗?
答案 0 :(得分:1)
由于ExtendedProtectionPolicy
是不可变的,您需要将其替换为根据需要配置的新实例,而不是更新现有实例,例如。
binding.Security.Transport.ExtendedProtectionPolicy =
New System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy(
System.Security.Authentication.ExtendedProtection.PolicyEnforcement.Never
)