Moved my ASP.NET website to IIS 8 on windows server 2012... services missing: .svc files are viewable, but their methods give a 404

OK, I gave up and paid Microsoft $250 for support. With the tech's help, we found the solution, and last night confirmed that it was definitely the solution for all our servers: We disabled SSL altogether for WCF services in the web.config:

<system.serviceModel>
    <bindings>
        <webHttpBinding>
            <binding>
                <security mode="Transport" />

The "Transport" refers to Transport Layer Security (TLS is the new SSL) so HTTPS. Changed that to:

<system.serviceModel>
    <bindings>
        <webHttpBinding>
            <binding>
                <security mode="None" />

Turns out WCF is extremely sensitive to whether you are using HTTP or HTTPS, and if you are using the wrong one you get no helpful errors, just 404.

In my case, both old and new servers were configured to use HTTPS at all times for security. But on the new servers, the SSL (TLS) encryption terminated on the load balancer. In that case encryption only happened between the user's browser and our load balancer, and the traffic between our load balancer and the web servers was unencrypted HTTP.

So the service was listening on HTTPS, and when the request came on HTTP, it just completely ignored it.

(All the other talk about similar issues online focused on uninstalling and reinstalling IIS and ASP.NET and WCF and HTTP Activation and such, so I hope this helps someone. I recommend MS Support if you have a question on the MS stack that SO can't answer in time. It was certainly much cheaper than wasting a few more hours trying to fix it alone).


Please check if your IIS has svc handler added.

WCF services don’t run on IIS 8 with the default configuration, because the webserver doesn’t know, how to handle incoming requests targeting .svc files. You can teach it in two steps:

  1. Add a new MIME type:

Extension: .svc MIME type: application/octet-stream

enter image description here

  1. Add a new Managed HTTP Handler:

    Request path: *.svc Type: System.ServiceModel.Activation.HttpHandler Name: svc-Integrated

enter image description here

Refresh your website/web application

References:

http://gyorgybalassy.wordpress.com/2012/09/24/publishing-a-wcf-service-on-iis8/

http://proq.blogspot.hk/2012/09/wcf-on-iis-and-windows-8.html

http://forums.iis.net/t/1200413.aspx?+svc+missing+can+t+find+Module+to+load+within+Handler+Mapping+IIS+8+0


Just wanted to provide a collection of suggestions in case you haven't tried one of these:

  • Any chance the [OperationContract] is missing for the intended method?
  • Do you have any url rewrites configured in the web.config that could be redirecting the method calls, such as an HTTP/S redirect or some route configuration?
  • Enable Failed Request Tracking in your IIS to see what sub-type of 404 error you are getting? 404.13? something else? It is likely not because something isn't found, but some other error in the request.

Additional Sources:

  • http://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis
  • WCF service returning 404 on method reqests
  • https://social.msdn.microsoft.com/Forums/vstudio/en-US/7d69a209-489e-486c-81f4-a660c539ae49/wcfiis-7-returns-404-but-only-for-some-method-arguments?forum=wcf
  • https://social.msdn.microsoft.com/Forums/vstudio/en-US/7d69a209-489e-486c-81f4-a660c539ae49/wcfiis-7-returns-404-but-only-for-some-method-arguments?forum=wcf