mimo
mimo

Reputation: 6817

WCF SOAP service returns 404 Not Found for HTTPS endpoint

I got .NET 4.5 WCF service hosted in IIS 8.5 on domain https://mydomain, with https binding and self signed certificate configured in IIS.

I can access the configuration page of my service in browser on https://mydomain/FileService.svc

When I try to POST some data to the service using SoapUI to the endpoint https://mydomain/FileService.svc/receiveRequest, I get back HTTP/1.1 404 Not Found

My web.config service configuration looks as follows:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <!-- maxReceivedMessageSize = 1073741824 = 1 GB -->
      <binding maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824" >
        <security mode="None"></security>
      </binding>
    </basicHttpBinding>
  </bindings>

  <behaviors>
    <serviceBehaviors>
      <behavior>
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>

  <protocolMapping>
    <add binding="basicHttpBinding" scheme="http" />
  </protocolMapping>

  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  <services>

    <service name="Foo.FileService">
      <endpoint contract="IFileService" binding="basicHttpBinding"></endpoint>
    </service>
  </services>
</system.serviceModel>

Any idea how to solve this or get some more information for further debugging? Thanks.

EDIT 1

I have tested the service on my dev machine. It was deployed on http://localhost and the call from SoapUI worked. I used http://localhost/FileService.svc/receiveRequest to call the service endpoint and it responded with 200 and SOAP message.

EDIT 2

When accessing the WCF service endpoint http://mydomain/FileService.svc/receiveRequest on my test machine without HTTPS it works.

Upvotes: 3

Views: 8382

Answers (1)

mimo
mimo

Reputation: 6817

Finally cracked it! I was missing binding for HTTPS endpoint, where security mode can not be set to None.

This is updated configuration for bindings:

<basicHttpBinding>
  <binding name="myHttpsBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
    <security mode="Transport">
      <transport clientCredentialType="None"/>
    </security>
  </binding>

  <binding name="myHttpBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
    <security mode="None" />
  </binding>    
</basicHttpBinding>

This is updated configuration for service endpoints:

<service name="Foo.FileService">
  <!-- HTTPS Endpoint -->
  <endpoint contract="IFileService" binding="basicHttpBinding" bindingConfiguration="myHttpsBinding" ></endpoint>
  <!-- HTTP Endpoint -->
  <endpoint contract="IFileService" binding="basicHttpBinding" bindingConfiguration="myHttpBinding" ></endpoint>
</service>

And now both endpoints http://mydomain/FileService.svc/receiveRequest and https://mydomain/FileService.svc/receiveRequest work for me.

Upvotes: 6

Related Questions