【问题标题】:HTTPS webservice using WCF使用 WCF 的 HTTPS 网络服务
【发布时间】:2014-03-25 13:23:57
【问题描述】:

我尝试通过代理连接到 https 网络服务。

下面是代码sn-p

    Dim strProxyURL As String = "http://myproxy.com"
    Dim mypingRequest As New pingRequest()
    Dim httpUri As New Uri("https://mysite.com")
    Dim mybinding As New WSHttpBinding()
    Dim remoteAddress As New EndpointAddress(httpUri)

    mybinding.UseDefaultWebProxy = True

    mybinding.BypassProxyOnLocal = True


    mybinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Windows

    mybinding.MessageEncoding = WSMessageEncoding.Mtom
    mybinding.TextEncoding = System.Text.Encoding.UTF8
    mybinding.Security.Mode = SecurityMode.TransportWithMessageCredential 'TransportWithMessageCredential

    mybinding.Security.Message.ClientCredentialType = MessageCredentialType.Windows

    Dim myMBClient As New v1_PortTypeClient(mybinding, remoteAddress)

    myMBClient.ClientCredentials.Windows.ClientCredential.UserName = "username"
    myMBClient.ClientCredentials.Windows.ClientCredential.Password = "pwd"

    myMBClient.ping()

当我使用代理时,我错误代理身份验证需要错误 如果我从桌面删除代理并使用直接互联网,那么我会转到站点 Web 服务,但即使提供了正确的用户名和密码也无法登录

【问题讨论】:

  • 问题已解决。 WCF Web 服务使用自定义绑定,因此会出错。我还添加了 webrequest.defaultwebproxy 和凭据,以便在请求客户端 stackoverflow.com/questions/187001/… 通过 Web 代理访问

标签: wcf


【解决方案1】:

问题已解决。 WCF Web 服务使用自定义绑定,因此会出错。我还添加了 webrequest.defaultwebproxy 和凭据,以便在请求客户端 WCF Custom Http Proxy Authentication

时通过 Web 代理访问

【讨论】:

    猜你喜欢
    • 2010-11-18
    • 1970-01-01
    • 2015-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-24
    • 2010-10-23
    • 1970-01-01
    相关资源
    最近更新 更多