Web Services 提供的URI方案“https”无效;在.Net Core 3.1中应为“http”

eaf3rand  于 2022-11-15  发布在  .NET
关注(0)|答案(1)|浏览(383)

我们开发了一个.Net Core 3.1应用程序,它使用WCF Web服务(也是我们开发的)。在我们的办公室里一切都很好。我们在开发中不使用SSL,但在生产服务器上使用SSL。在生产中,当应用程序试图使用Web服务时,会收到下一个错误
[500].系统.参数异常:提供的URI方案“https”无效;在系统.服务模型.通道.传输通道工厂'1.验证方案(Uri via)中需要' http '.(参数' via ')....
如何将http调用“转换”为https?我们找到了有关.net 4.5的信息,但在.net core 3.1中没有找到。
PD:我们无法从我们的办公室访问生产级wsdl

aiqt4smr

aiqt4smr1#

在web.config文件中。
更改自

<security mode="None">

<security mode="Transport">

或在代码中设置

System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();
...
binding.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport;
...

此更改将允许您使用https而不是http。

相关问题