105

I am developing an application based on .Net Framework 3.5 sp1 and hosted on windows server 2008(64bit).

While browsing wcf service (.svc) locally every things is ok but while browsing with full domain URL, it got an error.

local address is like this: http://localhost/MyService.svc

and domain address is like this: http://MySite.ir/MyService.svc

by the way pages (.aspx) and other files work correctly both on localhost and with domain address.

any Idea would be appreciated

Here is detailed error:


HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error Information

Module: StaticFileModule

Notification: ExecuteRequestHandler

Handler: StaticFile

Error Code: 0x80070032

Requested URL: http://MySite.ir:80/MyService.svc

Physical Path: D:\inetpub\vhosts\MySite.ir\httpdocs\MyService.svc

Logon Method: Anonymous

Logon User Anonymous

Mori
  • 2,484
  • 5
  • 28
  • 45

7 Answers7

251

Please make sure you've activated WCF components from here.

Or alternate and easy way is, go to control panel -> Turn Windows feature on or off -> and make sure you've all the options ticked as mentioned in below screenshot.

enter image description here

You might need to activate each box and accept in case you get errors when activating all features at once

Mauricio Gracia Gutierrez
  • 10,288
  • 6
  • 68
  • 99
Nirav Mehta
  • 6,943
  • 9
  • 42
  • 51
27

OK, here is the answer:

Go to Handler Mappings | Add Handler Manager --> And then add below information

Request Path: *.svc

Type: System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Name: svc-Integrated

Mori
  • 2,484
  • 5
  • 28
  • 45
  • 3
    For anyone wanting to add this to their web.config file, this works for me in a .NET 4.5 project: – Stefan Mohr Jul 31 '14 at 16:45
  • 8
    For me, adding the line from @StefanMohr to the Web.config didn't quite work. However, I changed `path="*.svc"` and `verb="*"` and it worked great. Thus, the line I used that worked was: `` (added at configuration / system.webServer / handlers). – Aron Boyette Apr 21 '15 at 21:42
11

If anyone has this issue on Windows Server 2012, Bill Moon's answer here solved it for me:

"For Windows Server 2012... From the Server Manager, click on Add roles and features, select the appropriate server, then select Features. Under .NET Framework 4.5 Features, you'll see WCF Services, and under that, you'll find HTTP Activation."

Community
  • 1
  • 1
Will
  • 2,790
  • 19
  • 22
  • 1
    In any existing web application you will also have to do the following after adding the Windows feature: - Start inetmgr - Open "Handler mappings" - Check if the svc-ISAPI mappings for extension *.svc are present. If not, use the "Revert To Parent" action to copy them from the parent website. Note that this assumes that custom handler mappings are configured in web.config for the application, as is usually the case in IIS7+. If not, you will lose those when executing "Revert To Parent". – Berend Engelbrecht Jul 30 '14 at 06:58
10

I have windows 10 in my laptop and using visual studio 2015 for WCF development. WCF is running fine in visual studio but when hosted in IIS I got the same error.

I checked IIS handler. svc extension was missing. So I tried to add new handler in IIS as suggested by Mori in first answer. I didn't find type "System.ServiceModel.Activation.HttpHandler".

So I opened "Turn windows features On or Off" and installed features as highlighted in screen shot.

This worked for me.

enter image description here

Community
  • 1
  • 1
Anil
  • 1,669
  • 5
  • 19
  • 44
0

If you're using .Net 4.x, the PublicKeyToken is 31bf3856ad364e35.

However, following this post about installing WCF Services properly in IIS, the handler was set up for me.

Community
  • 1
  • 1
Thomas Hagström
  • 4,371
  • 1
  • 21
  • 27
0

I wanted to add this as a comment to the answer but didn't have enough rep for it. I tried running ServiceModelReg and aspnet_regiis.exe with various flags and added HTTP Activation feature but it still didn't work. Even using the Handler mapping UI in IIS didn't work since it could not find System.ServiceModel.Activation.HttpHandler. What finally worked was adding the handler Mori mentions manually to my web.config file.

<system.webServer>
    <handlers>
      <add name="svc-Integrated" path="*.svc" verb="GET,HEAD,POST,DEBUG" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

My project was running .Net 3.5 and IIS 7.5 on Windows 7 and IIS 7.0 on Win Server 2008 R2.

Janspeed
  • 2,644
  • 2
  • 22
  • 22
0

Try unchecking WCF HTTP activations from "Turn Windows featured on or off" window (See here) and re-install by going to

%windir%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\

and execute ServiceModelReg -i

Stefan Ferstl
  • 5,135
  • 3
  • 33
  • 41
  • Any idea on how to perform this wizardry on Windows Server 2012 and up? "Windows features" simply opens the Server Manager and there is no role that includes these features I can find in 2012 OR 2016 OR 2019! – MC9000 Oct 05 '21 at 23:18