使用 configurationName
参数删除 WCF API
接受参数或endpointConfigurationName
参数的 WCF API configurationName
已在 WCF 8 中删除。 这些 API 以前在 .NET Framework 中使用,用于加载客户端配置参数,例如 Binding
配置和 EndpointAddress
详细信息。
引入的版本
WCF 客户端 8.0 正式版
旧行为
已删除的 API 以前已从 IntelliSense 建议中取消,但使用它们的项目已成功编译。 使用任何已删除的 API 在运行时导致 PlatformNotSupportedException 。
新行为
受影响的 API 不再存在。 如果升级到 WCF 8 并重新编译项目,它将失败。
中断性变更的类型
此项更改可能会影响源兼容性。
更改原因
受影响的 API 从未在 .NET 上实现,并且以前对这些 API 的任何调用都会导致运行时异常。 因此,决定完全删除它们。
建议的操作
删除受影响 API 的任何用法。
如果使用由 .NET Framework SDK 中的实用工具生成的 svcutil
WCF 客户端,则生成的客户端将具有调用已删除基类构造函数的构造函数。 基类为或 ClientBase<TChannel> DuplexClientBase<TChannel>。 生成的构造函数在 .NET 上不可用,导致 PlatformNotSupportedException
引发。
- 如果你是多目标 .NET Framework 和 .NET,并且仍在 .NET Framework 上使用这些生成的构造函数,则需要有条件地编译它们的用法。
- 如果不使用这些构造函数,可以从生成的代码中删除它们。 或者,请考虑使用
dotnet-svcutil
..
受影响的 API
- NetHttpBinding(String)
- NetTcpBinding(String)
- System.ServiceModel.ChannelFactory.ApplyConfiguration(String)
- System.ServiceModel.ChannelFactory.InitializeEndpoint(String, EndpointAddress)
- ChannelFactory<TChannel>(String)
- ChannelFactory<TChannel>(String, EndpointAddress)
- DuplexChannelFactory<TChannel>(InstanceContext, String)
- DuplexChannelFactory<TChannel>(InstanceContext, String, EndpointAddress)
- DuplexClientBase<TChannel>(InstanceContext, String)
- DuplexClientBase<TChannel>(InstanceContext, String, EndpointAddress)
- DuplexClientBase<TChannel>(InstanceContext, String, String)