Knowledgebase: ASP .NET / ASP
How to Fix: WCF .SVC File Gives A 404 Error
Posted by on 08 December 2010 07:36 PM

Arvixe's servers all have WCF service installed by default. If visiting an SVC file gives a 404 error, it is most likely because the handler mappings for svc have been removed from your site somehow. To fix this, simply add the svc handlers to your web.config. The handlers described are below. Underneath them is an example of adding a managed handler(these would go into the <handlers> section of the web.config responsible for your application), if you need assisetance with writing the handler mappings many resources exist online as its a standard addition:

1)
Request path: *.svc
Executable: %SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll
Name: svc-ISAPI-2.0-64

2)
Request path: *.svc
Executable: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
Name: svc-ISAPI-4.0_32bit

3)
Request path: *.svc
Executable: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
Name: svc-ISAPI-4.0_64bit

4) 
Request path: *.svc
Executable: %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
Name: svc-ISAPI-2.0

5)
This one is a Managed Handler, not a script map:
Request path: *.svc
Type: System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Name: svc-Integrated-4.0


6) 6) 2.0 Integrated (3.0)
This one is a Managed Handler, not a script map:
Request path: *.svc
Type: System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Name: svc-Integrated-4.0

 

 

Example of a managed handler:

<add name=".svc"

            verb="*" 

           path="*.svc"

           type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

 

 

(12 vote(s))
Helpful
Not helpful

Comments (13)
Vit
06 July 2011 01:39 PM
Hi

I've have a WCF service on .NET 4.0 hosting on arvixe but my service but work. The error that recived on browser is not a 404. I've add the handler on my web.config like you said

<system.webServer>
<handlers>
<remove name="svc-Integrated-4.0" />
<add name="svc-Integrated-4.0" path="*" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>

Can anyone help me!?
Arvand Sabetian
07 July 2011 05:24 PM
What is the error? I would suggest putting in a ticket and posting your issue and ticket ID on our forum as well.
Vincent Sasso
02 October 2011 11:51 AM
I am getting a 500 server error and have the above handlers setup. I have an open ticket #UCN-269-33055. I did notice when I removed handlers they were reapplied using:
Request path: *.svc
Type: System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Name: svc-Integrated-4.0

...even though I have this set to 4.0 Integrated.

Please help.
Ryan C
19 October 2011 08:19 AM
I've checked on your ticket and it appears you was able to get this resolved; and I see you provided the resolution so I will provide it here on hopes it may help someone else.

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix="http://appservices.DOMAIN.COM" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
ahmed hussein
19 August 2013 07:22 AM
1-it work well for ASP.net web site by adding below tag in Web.config file
<system.webServer>
<handlers>
<add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>

2- this issue can solved for all site that using wcf service by adding Handler Mappings *.svc within iis on Hosting server
Michael Carr
21 August 2013 11:16 AM
Thanks for the comment.
Sandro Klostermann
11 February 2014 10:51 AM
I did exactly as explained. Now it works fine in normal situations. But if I want to programmatically return an error message to the client using FaultException, it actually returns an HTTP 500 error.
Michael Carr
18 February 2014 08:42 AM
I would suggest asking for help on a programming forum.
Roy Oliver
01 May 2014 03:40 PM
The only thing that worked for me:
http://forum.arvixe.com/smf/programming-questions-tutorials/wcf-with-https/
Blop
06 November 2014 10:35 AM
Thanks for your post, worked on win8.1 IIS8.5.
You save my night!
Michael Carr
06 November 2014 10:47 AM
Glad to see you found the article helpful.
Keval Mehta
19 May 2015 06:09 AM
Thanks ahmed hussein your solution worked

I added following code in my web.config file

<system.webServer>
<handlers>
<add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>

<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
</serviceHostingEnvironment>
</system.serviceModel>
Ryan C
28 May 2015 02:30 PM
Thank you for the feedback!
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).