wcf - 无法使用 https 调用 Azure 中托管的 WCF 服务的方法

标签 wcf https azure

我有一个托管在 Azure 中的 WCF 服务,我能够正确获取 wsdl,但在尝试调用方法时出现以下错误。

There was no endpoint listening at https://pactwp7.cloudapp.net/Service1.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

我在设置 https 时使用了自签名证书,因此在从客户端访问服务之前我添加了以下内容: ServicePointManager.ServerCertificateValidationCallback = (发件人、证书、链、错误) => true;

以下是我使用的服务配置:

<system.serviceModel>
<behaviors>
  <serviceBehaviors>        
    <behavior name="httpsAzureBehavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <useRequestHeadersForMetadataAddress>
        <defaultPorts>
          <add scheme="http" port="80" />
          <add scheme="https" port="443" />
        </defaultPorts>
      </useRequestHeadersForMetadataAddress>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <customBinding>
    <binding name="httpsBinding">
      <binaryMessageEncoding />
      <httpsTransport allowCookies="true" />
    </binding>
  </customBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" 
                           aspNetCompatibilityEnabled="true" />
<services>
  <service behaviorConfiguration="httpsAzureBehavior" 
           name="PactServices.ServiceImplementation.PactService">
    <endpoint address="" binding="customBinding" 
                         bindingConfiguration="httpsBinding"
                         contract="PactServices.ServiceContracts.IPactServices" 
                         listenUri="Service1.svc" />
    <endpoint address="mex" binding="mexHttpBinding" 
              contract="IMetadataExchange" />
  </service>
</services>

有什么原因吗?

最佳答案

您是否在 CSDEF 文件上打开了 443 输入端点?

我认为 RDP 到您的虚拟机并进行本地尝试可能有助于识别和调试。

关于wcf - 无法使用 https 调用 Azure 中托管的 WCF 服务的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10676114/

相关文章:

c# - 如何摆脱 app.config 并将其全部移至代码中?

wcf - IClientMessageInspector 关联状态

WCF 服务合约接收来自 ExtJs 前端的文件上传

php - 廉价的客户端识别和正确的 SSL 客户端身份验证

azure - 如何在 PowerShell 中通过 MSI 访问 Azure SQL 数据库

azure - 如何使用代码验证逻辑应用 microsoft.web/connections 连接

c# - AggregateException 和 WCF

python-2.7 - 使用网页回放录制 HTTPS 网页

Azure Bicep 脚本在第二次执行时产生错误 "Changing property > ' agentPoolProfile.vnetSubnetID' is not allowed."

php - 获取在 PHP 上不使用 curl 的网页(文本)的内容