WCF service returning 404 on method requests

I would start by checking a number of things;

  • Permissions on the hosted directory?
  • .Net version is correct?
  • Have you added the certificate to the site?
  • Try putting an image in the same path, can you navigate to that (rule out the odd occasional path mappings)

Good luck!


The first thing I do whenever I hit a 404 with a newly-developed WCF Web Service is checking the handler mapping required to interpret this type of call, because it's often the cause of the issue. There are several ways to work around the problem, many of which require a manual execution of the ServiceModelReg.exe console command: these are undoubtedly valid procedures but might also not work – or create additional problems – if your development machine has a particularly complex configuration. The resolution method I propose below is slightly longer to pull off, but has the advantage of solving the problem more safely and securely.

  • Open the Server Manager interface for machine management, usually present in both the Task Bar and the Start menu.
  • Go to the Dashboard (or Control Panel) and select Add Role or Feature to open the Wizard.
  • Select the Role-based or Feature-based installation type and the server you want to work on, that is, your local / local server.
  • Go to the Features section: Once there, expand the .NET Framework 3.5 Features node and / or the .NET Framework 4.5 Features node, depending on what you have installed: if you have both, you should perform the following step twice (for each one of them).
  • Expand the WCF Services section (if available), then select HTTP Activation (see screenshot below).
  • Continue until you complete the Wizard, then click Install.

enter image description here

Once the installation is complete, you should be able to run your WCF Service without incurring in the 404 error ever again.

For additional info regarding this specific issue and how to fix it, you can also read this post on my blog.


You can implement transport level security using WsHttp bindings. See this article; in your bindings try this biding instead:

<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>

The article mentions you should tie up the bindings with the end points.

Tags:

C#

Wcf

Ssl

Iis 7.5