gpt4 book ai didi

c# - .net 核心中的 WCF (TransportWithMessageCredential)

转载 作者:行者123 更新时间:2023-11-30 17:32:50 24 4
gpt4 key购买 nike

当我尝试在 dotnet core 2.0 中创建到 WCF 客户端的连接时,我收到平台不支持的错误:

System.PlatformNotSupportedException: 'The value 'TransportWithMessageCredential' is not supported in this context for the binding security property 'securityMode'.'

如果我删除 BasicHttpSecurityMode,我会收到一个参数异常: System.ArgumentException: '提供的 URI 方案 'https' 无效;预期为“http”。

代码:

ChannelFactory<BlackBoxContract> factory = null;
BlackBoxContract serviceProxy = null;
Binding binding = null;

binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

factory = new ChannelFactory<BlackBoxContract>(binding, new EndpointAddress("https:......."));;
serviceProxy = factory.CreateChannel();

有人找到了解决方法,因为这可能在长期路线图上吗? https://github.com/dotnet/wcf/issues/8

最佳答案

这已被最新的软件包修复。

  <ItemGroup>
<PackageReference Include="System.ServiceModel.Duplex" Version="4.6.0" />
<PackageReference Include="System.ServiceModel.Http" Version="4.6.0" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.6.0" />
<PackageReference Include="System.ServiceModel.Security" Version="4.6.0" />
</ItemGroup>

关于c# - .net 核心中的 WCF (TransportWithMessageCredential),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45567598/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com