HTTP 404 when accessing .svc file in IIS

C#.NetWcf

C# Problem Overview


I recently created a WCF service that works fine when tested from Visual Studio 2008. but when I deploy the project to IIS and I try to access the .svc file from IIS, I get this error :

"Server Error in '/' Application.The resource cannot be found.  "

I've been having this issue for the past 4 days .

in the Handler Mappings of IIS Manager, I can see two entries for .svc :

svc-Integrated and svc-ISAPI-2.0

C# Solutions


Solution 1 - C#

What worked for me, On Windows 2012 Server R2:

WCF HTTP 404

Thanks goes to "Aaron D"

Solution 2 - C#

You need to add a mapping for the SVC extension to ASP.NET. The easiest way to do this is to run ServiceModelReg.exe -i from C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation. You may also need to enable ASP.NET if you haven't already done so.


If you are using Windows Server 2012 or 2016, follow these instructions instead:

Solution 3 - C#

I found these instructions on a blog post that indicated this step, which worked for me (Windows 8, 64-bit):

Make sure that in windows features, you have both WCF options under .Net framework are ticked. So go to Control Panel –> Programs and Features –> Turn Windows Features ON/Off –> Features –> Add Features –> .NET Framework X.X Features. Make sure that .Net framework says it is installed, and make sure that the WCF Activation node underneath it is selected (checkbox ticked) and both options under WCF Activation are also checked.

These are:

  • HTTP Activation

  • Non-HTTP Activation Both options need to be selected (checked box ticked).

Solution 4 - C#

I see you've already solved your problem - but for posterity:

We had a similar problem, and the SVC handler was already correctly installed. Our problem was the ExtensionlessUrl handler processing requests before they reached the SVC handler.

To check this - in Handler Mappings in IIS Manager at the web server level, view the list of handlers in order (it's an option on the right-hand side). If the various ExtensionlessUrl handlers appear above the SVC handlers, then repeatedly move them down until they're at the bottom.

Solution 5 - C#

None of the above solutions resolved this error for me. I had to set the following in web.config:

system.servicemodel > bindings > webHttpBinding > binding:
<security mode="Transport">
  <transport clientCredentialType="None" />
</security>

I would like to take this opportunity to CURSE Microsoft once again for creating such a huge mess with the .NET Framework and making developer lives so miserable for so long!

Solution 6 - C#

Verifies that you directory has been converted into an Application is your IIS.

Solution 7 - C#

I've had the same problem today.

For me, the solution was to go into IIS, right-click on the new Web Site name, select Properties, ASP.Net, and change the ASP.Net version from "1.1.4322" (which it had set as the default) to 2.0.50727.

Once I'd done that, I could right-click on the .svc file, click on "Browse" and see the friendly Service webpage.

Solution 8 - C#

This can also become an issue after enabling IIS 6 Management Compatibility in windows 10. Setting the framework HTTP Activation under WCF Services will fix the problem.

Solution 9 - C#

In my case, the error was caused by incorrect mapping settings in the file applicationhost.config (\System32\inetsrv\config). For some reason, Visual Studio 2013 corrupted it while creating a virtual directory in IIS. The fix was to manually edit the sites section in the file.

Solution 10 - C#

There are 2 .net framework version are given under the features in add role/ features in server 2012

a. 3.5

b. 4.5

Depending up on used framework you can enable HTTP-Activation under WCF services. :)

Solution 11 - C#

In my case Win 10. the file applicationHost.config is corrupted by VS 2012. And you can get the copy the history of this file under C:\inetpub\history. Then restart IIS and it works properly.

Solution 12 - C#

I had to add the extension .svc to the allowed extensions in the request filtering settings (got 404.7 errors before).

enter image description here

Solution 13 - C#

Adding the .svc suffix as allowed in request filtering did the trick for me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAttilahView Question on Stackoverflow
Solution 1 - C#Stefan MichevView Answer on Stackoverflow
Solution 2 - C#tvanfossonView Answer on Stackoverflow
Solution 3 - C#Aaron DView Answer on Stackoverflow
Solution 4 - C#Inigo SurguyView Answer on Stackoverflow
Solution 5 - C#SmyrnianView Answer on Stackoverflow
Solution 6 - C#esylvestreView Answer on Stackoverflow
Solution 7 - C#Mike GledhillView Answer on Stackoverflow
Solution 8 - C#Al NolanView Answer on Stackoverflow
Solution 9 - C#user405723View Answer on Stackoverflow
Solution 10 - C#Raj kumarView Answer on Stackoverflow
Solution 11 - C#phuongdnguyenView Answer on Stackoverflow
Solution 12 - C#martinossView Answer on Stackoverflow
Solution 13 - C#Brian KingView Answer on Stackoverflow