200

When I try to serve a WCF service on IIS in a Windows 8 machine, I get the well known error

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.

The old work around was to run aspnet_regiis -i but this command seems to have been deprecated in Windows 8 yielding response This option is not supported on this version of the operating system. (...).

What would be the work around?

(I have successfully enabled regular aspx pages already, so most of the IIS config seems healthy.)

user247702
  • 21,902
  • 13
  • 103
  • 146
faester
  • 14,108
  • 3
  • 40
  • 54
  • For more information on the `aspnet_regiis -i` command for pre-Windows 8 users, see this link: http://www.aspsnippets.com/Articles/ASPNet-IIS7-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.aspx – David Aug 29 '16 at 23:57
  • **See Also**: [WCF on IIS8; \*.svc handler mapping doesn't work](https://stackoverflow.com/q/11116134/1366033) – KyleMit Sep 08 '20 at 00:11

6 Answers6

416

Seemed to be a no brainer; the WCF service should be enabled using Programs and Features -> Turn Windows features on or off in the Control Panel. Go to .NET Framework Advanced Services -> WCF Services and enable HTTP Activation as described in this blog post on mdsn.

From the command prompt (as admin), you can run:

C:\> DISM /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation
C:\> DISM /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation45

If you get an error then use the below

C:\> DISM /Online /Enable-Feature /all /FeatureName:WCF-HTTP-Activation
C:\> DISM /Online /Enable-Feature /all /FeatureName:WCF-HTTP-Activation45
Callum Watkins
  • 2,444
  • 2
  • 27
  • 42
faester
  • 14,108
  • 3
  • 40
  • 54
  • 6
    I spent time looking in IIS Manager. I think IIS Manager should have an icon directing or telling the user about .NET Framework Advnaced Services. – Tony_Henrich Jul 20 '13 at 19:28
  • Using the command prompt I got the error "The operation is complete but WCF-HTTP-Activation feature was not enabled. A required parent feature may not be enabled. You can use the /enable-feature /all option to automatically enable each parent feature from the following list. If the parent feature(s) are already enabled, refer to the log file for further diagnostics.". I used the GUI method instead in order to know what I was turning on and it worked. – Ben Adams Jul 31 '14 at 08:08
  • 5
    I got the same "A required parent feature may not be enabled" error as Ben Anderson, and tried the suggestion in the error message (adding the `/all` argument), which then worked fine: `DISM /Online /Enable-Feature /all /FeatureName:WCF-HTTP-Activation45`. – Troy Gizzi Jan 16 '15 at 22:25
  • 2
    You sir, are amazing. You could also add (it's a tiny detail) that this can be done depending on the .Net Framework version. As in `.NET 3.5 Framework Advanced Services -> Windows Communication Foundation HTTP Activation` – rion18 Apr 21 '15 at 18:33
  • This is a life saver. Most online solutions to this problem only have you enabling .Net 3.5 Framework under Web features. THAT ISN'T ENOUGH. You've also got to take the step mentioned here. – markaaronky Sep 13 '17 at 13:56
  • Turning on the .NET Framework Advanced Services/WCF Services/HTTP Activation Windows feature his fixed the error I was getting when trying to Update Service Reference for a WCF service in Visual Studio. – jdnew18 Aug 23 '18 at 17:31
  • Worked great on Win 10 with WCF. Thanks. – Sanket Sonavane Aug 09 '19 at 07:08
95

For Windows Server 2012, the solution is very similar to faester's (see above). 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.

Bill Moon
  • 1,105
  • 7
  • 6
  • Thank you for this ! but how about .Net 4 ? you think that enabling this features will do the same for .Net v4.0 ? – Aladdin Gallas Feb 28 '13 at 14:26
  • 2
    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
13

Please do the following two steps on IIS 8.0

Add new MIME type & HttpHandler

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

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

  • Best solution for my very old Windows 7 Installation that fails to enable - .Net 3.5 (Http & Non-Http Activation) and WAS. Too delicate to reinstall the OS – user919426 Jul 02 '15 at 09:26
  • It's worth knowing about this method especially when creating and adding your own handlers. However, if you use the 'turn Windows features on and off' you'll get most of the known file extensions, which will save you the time of adding each one individually (and finding out all the correct details) – Daniel Hollinrake Dec 06 '16 at 08:35
12

You can also achieve this by Turning windows feature ON. enter image description here enter image description here

Mohit Dharmadhikari
  • 2,620
  • 2
  • 16
  • 24
4

This is really the same solution as faester's solution and Bill Moon's, but here's how you do it with PowerShell:

Import-Module Servermanager
Add-WindowsFeature AS-HTTP-Activation

Of course, there's nothing stopping you from calling DISM from PowerShell either.

JamesQMurphy
  • 3,732
  • 1
  • 33
  • 37
-1

you can add this code to web.config in asp mvc

   <system.webServer>
    <staticContent>
      <remove fileExtension=".srt" />
      <mimeMap fileExtension=".srt" mimeType="text/srt" />
      <remove fileExtension=".vtt" />
      <mimeMap fileExtension=".vtt" mimeType="text/vtt" />
    </staticContent>
  </system.webServer>

you can change file extension with your file extension

malik masis
  • 327
  • 2
  • 8
  • Hi @malik - Could you clearify how mapping file extensions could make svc-endpoints work? – faester Oct 25 '18 at 13:40
  • if i understand correctly , you can change extension with your wanted. You can look from https://feedforall.com/mime-types.htm but you would say another thing, sorry i can't understand. – malik masis Oct 26 '18 at 12:17