简体   繁体   中英

Unable to invoke the methods of a WCF service hosted in Azure with https

I have a WCF service hosted in Azure, I am able to get the wsdl properly but when trying to call a method it gives me the following error.

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.

I have used a self signed certificate while making it https so I have added the following before accessing the service from the client side: ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, error) => true;

Below is the service config that I have used:

<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>

any reasons why?

Did you open the 443 for input endpoint on your CSDEF file?

RDP to your VM and have a local try might helps to identify and debug I think.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM