在vb.net中消费Web服务

发布于 2025-02-06 16:38:58 字数 957 浏览 5 评论 0原文

我尝试使用vb.net语言消费Web服务。但是,我收到了错误该请求被中止:无法创建SSL/TLS安全频道调用Web Service

然后,在Internet中搜索了一些解决方案之后,主要建议添加ServicePointManager.securityprotocol。我已经尝试过,但是然后收到 system.web.services.protocols.soapexception:'服务器错误'

有人可以帮我吗?实际上,我是Web服务的新手。以前它可以正常工作,直到团队将SSL添加到服务器为止。仅供参考,使用密码套件SSL的服务器。我的代码在.NET 4.5.2上运行。

这是我的代码:

ServicePointManager.Expect100Continue = True
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

Dim EMIWS As New WebReference.SyncTimeOut
EMIWS.Credentials = New System.Net.NetworkCredential("Here I put my credentials")
EMIWS.Url = "Here is the proxy server"
        
'pass value
Dim WS_value As New WebReference.SyncTimeOut_Request
WS_value.StudentID = "Some ID"
WS_value.StudentTimeIn = "Some Time In"

'get value
Dim ReturnData As WebReference.SyncTimeOut_Response = EMIWS.Get_SyncTimeOut(ws_value)

解决方案: 我只是升级到.NET 4.7,它起作用了!

I try to consume web service using vb.net language. However, I received error The request was aborted: Could not create SSL/TLS secure channel call web service.

Then after searching some solution in Internet, mostly suggest to add ServicePointManager.SecurityProtocol. I've tried it, but then received System.Web.Services.Protocols.SoapException: 'Server Error'.

Can someone help me? Actually I new to web service. Previously it works fine until IT Team add SSL to the server. Fyi, the server using Cipher Suite SSL. My code running on .NET 4.5.2.

Here is my code:

ServicePointManager.Expect100Continue = True
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

Dim EMIWS As New WebReference.SyncTimeOut
EMIWS.Credentials = New System.Net.NetworkCredential("Here I put my credentials")
EMIWS.Url = "Here is the proxy server"
        
'pass value
Dim WS_value As New WebReference.SyncTimeOut_Request
WS_value.StudentID = "Some ID"
WS_value.StudentTimeIn = "Some Time In"

'get value
Dim ReturnData As WebReference.SyncTimeOut_Response = EMIWS.Get_SyncTimeOut(ws_value)

Solution:
I just upgrade to .NET 4.7 and it works!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文