2 回答
TA贡献1808条经验 获得超4个赞
只需在添加服务引用后编辑 .csproj 文件并将这些依赖项从 4.4.* 指向 4.6.*
<ItemGroup> <PackageReference Include="System.ServiceModel.Duplex" Version="4.6.*" />
<PackageReference Include="System.ServiceModel.Http" Version="4.6.*" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.6.*" />
<PackageReference Include="System.ServiceModel.Security" Version="4.6.*" />
</ItemGroup>
并添加这个
binding.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.TransportWithMessageCredential;
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
TA贡献1803条经验 获得超6个赞
这个问题在较新版本的 System.ServiceModel.* 包中得到解决(4.7.0 对我有用)。
见https://github.com/dotnet/wcf/issues/4045#issuecomment-577854822
- 2 回答
- 0 关注
- 117 浏览
添加回答
举报