首页 > 解决方案 > .NET 4.5 DLL 访问 SOAP 1.2 服务的身份验证问题

问题描述

我们正在开发一个需要访问 SOAP 1.2 服务并使用 DLL 转换为 JSON 的项目。我们已经构建了所有内容,但被 .NET 4.5 中的身份验证问题所困扰,而这些问题在 .NET 5 中不会发生。我们认为这是一个简单的配置问题,但可能已经让 myoptic 试图让它工作。好奇是否有人遇到过类似的问题并有任何见解......

背景:

我们的问题:

WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.None;
EndpointAddress endpointAddress = new EndpointAddress("http://...SummaryService.svc");                
ServiceClient client = new ServiceClient(binding, endpointAddress);
var result = await client.SomeFunctionAsync();

注意:从 .NET 5.0 应用程序运行此代码时,没有问题;我仅在 .NET 4.5 .DLL/.EXE 中看到此错误。

有什么建议吗?TIA

标签: .netwcfsoapdll

解决方案


您可以按照以下步骤检查您的配置:

  1. 检查您的安全模式并设置为TransportCredentialOnly

  2. 确保服务器端和客户端是相同的绑定。

  3. 设置代理类以允许模拟。

    Customer_PortClient proxy = new Customer_PortClient(); proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation


推荐阅读