WCF on IIS8; *.svc handler mapping doesn't work
Asked Answered
U

12

287

I'm trying to get a WCF service running in IIS8 on Windows Server 2012 build 8400.

When installing the web role the WCF stuff (under 3.51) wasn't to be found like in Windows Server 2008.

When installed the svc handler mapping was missing, so i did a:

%windir%\Microsoft.NET\Framework\v3.0\WindowsCommunication Foundation\ServiceModelReg.exe –i

Now the handler mapping is there, but I still get:

The resource you are looking for does not have a handler associated with it.

(I removed the static file handler.)

The site is using the classic pipeline in order to use impersonation.

Unaccomplished answered 20/6, 2012 at 9:2 Comment(0)
T
590

More specifically:

  1. Run Server Manager (on task bar and start menu)
  2. Choose the server to administer (probably local server)
  3. Scroll down to "Roles and Features" section.
  4. Choose "Add Role or Feature" from Tasks drop down
  5. On "Add Role or Feature Wizard" dialog, click down to "Features" in list of pages on the left.
  6. Expand ".Net 3.5" or ".Net 4.5", depending on what you have installed. (you can go back up to "roles" screen to add if you don't have.
  7. Under "WCF Services", check the box for "HTTP-Activation". You can also add non-http types if you know you need them (tcp, named pipes, etc).
  8. Click "Install" Button.
Tosspot answered 20/9, 2012 at 19:28 Comment(14)
This one didn't work in my case because I'm on Windows 8 (with IIS 8).Galacto
If you first ran ServiceModelReg.exe –i from the v3.0 directory, you need to also run ServiceModelReg.exe –ua to undo it before this will work.Horehound
From the command line: dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation /AllDelinquency
What is about gyorgybalassy.wordpress.com/2012/09/24/… ? which is better way ?Tracietracing
I needed to restart the server =(Advection
Josh - this worked for me with IIS 8.5 on Windows 8.1.Inebriate
@GWTF -- you were right -- that's what I was missing; I used ServiceModelReg.exe -u to uninstall it from the v3.0 directory, and the features I added earlier (using the steps in the answer) just worked.Olein
In my case, this got IIS to serve the service url - the actual .svc file, like example.com/service.svc but not the methods like example.com/service.svc/Method?Parameter=1. If anyone else has this problem, check your bindings, see this question: stackoverflow.com/questions/26398049Typhoid
Had to enable the HTTPS binding for the site as well.Thrust
I was literally staring at the "Server Roles" page for an hour. I had no idea you could just click "Next" or click down to "Features" on the left. o_O +1Kurland
I'd put two upvotes if it were possible ;). In my case it was migrated webservice from 2008 to 2012 R2 server. Thanks!Darlleen
Works for IIS 10 on Server 2016 tooNarah
Thanks! Works on Windows Server 2016 with iis 10 too!)))Gilead
From powershell: ServerManager\Install-WindowsFeature NET-WCF-HTTP-Activation45Sherl
N
234

I had to enable HTTP Activation in .NET Framework 4.5 Advanced Services > WCF Services

Enable HTTP Activation

Nose answered 23/1, 2013 at 23:33 Comment(5)
this is what you need to do for Windows 8 where there is no server managerFrederique
This is the answer when you're hosting the WCF Service in Windows 8 and Windows 8.1Diallage
The http activation. Is it regardless if you use http / https? Thus is that a summary name for both or is there still a distinction needed there?Chamfer
I faced similar issue on IIS 10, Http Activation is turned off by default. Enabling it resolved the issue right away. Thanks!Camarata
Works for Windows 10, IIS 10Tortuosity
F
47

turn ON the following on 'Turn Windows Features on or off'

a) .Net Framework 3.5 - WCF HTTP Activation and Non-Http Activation

b) all under WCF Services

Flagelliform answered 27/8, 2012 at 9:17 Comment(1)
I only had to turn on .Net Framework 3.5 - WCF HTTP ActivationTepee
F
41

Windows 8 with IIS8

  • Hit Windows+X
  • Select Programs and Features (first item on list)
  • Select Turn Windows Features on or off on the left
  • Expand .NET Framework 4.5 Advanced Services
  • Expand WCF Services
  • Enable HTTP Activation
Frederique answered 30/7, 2013 at 21:37 Comment(2)
any powershell script for do it programmatically ?Tracietracing
we have one server so I don't ever get into advanced PowershellFrederique
P
28

I prefer to do this via a script nowadays

REM install the needed Windows IIS features for WCF
dism /Online /Enable-Feature /FeatureName:WAS-WindowsActivationService
dism /Online /Enable-Feature /FeatureName:WAS-ProcessModel
dism /Online /Enable-Feature /FeatureName:WAS-NetFxEnvironment
dism /Online /Enable-Feature /FeatureName:WAS-ConfigurationAPI
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation45

REM Feature Install Complete
pause
Paragrapher answered 30/6, 2014 at 9:37 Comment(4)
Thanks dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation45 were sufficient for me ...Diverticulosis
This is the best way to fix this on a new 2012R2+ version of Windows Server. Probably works on 2012 as well but thankfully, I don't have anymore of those to try this out on.Lightfingered
and using PowerShell script ?Tracietracing
@Tracietracing These commands will all work in powershell. If you attempted to copy over Shubh's command directly you need to add a line break or semicolon after the first command before the second dism command.Mylohyoid
E
11

We managed to solve the error under Windows Server 2012 by:

  1. Removing from "Remove Roles and Features Wizard" .NET Framework 4.5 Features/ASP.NET 4.5 and all its dependent features
  2. Re-installing the removed features.

It seems the order of installation is the cause.

Also, make sure you have HTTP Activation installed under WCF Services.

Effort answered 11/3, 2013 at 9:53 Comment(2)
I did this and seem to have killed my server. I only uninstalled the asp.net stuff under iis, but now when I remote in I get a black screen and a command prompt window, like the server is only "server core" now... :(Typhoid
@Typhoid when you remove some of the features of .net 4.5 it looks like it also removes the Server Graphical Shell, this can be added again with some commands.Hourigan
C
3

For Windows 8 machines there is no "Server Manager" application (at least I was not able to find it).

Though I was able to resolve the problem. I'm not sure in which sequence I did the following operations but looks like one/few of following actions help:

  1. Turn ON the following on 'Turn Windows Features on or off' a) .Net Framework 3.5 - WCF HTTP Activation and Non-Http Activation b) all under WCF Services (as specified in one of the answers to this question)

  2. executed "ServiceModelReg.exe –i" in "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\" folder

  3. Registered ASP.NET 2.0 via two commands ( in folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727):

    aspnet_regiis -ga "NT AUTHORITY\NETWORK SERVICE" aspnet_regiis -iru

  4. Restarted PC... it looks like as a result as actions ## 3 and 4 something got broken in my ASP.NET configuration

  5. Repeat action #2

  6. Install two other options from the "Programs and Features": .Net Framework 4.5 Advanced Services. I checked both sub options: ASP.NET 4.5 and WCF services

  7. Restart App Pool.

Sequence is kind of crazy, but that helped to me and probably will help to other

Chemar answered 2/1, 2013 at 2:53 Comment(2)
The key bit is turning on HTTP Activation.Alkalosis
What's about gyorgybalassy.wordpress.com/2012/09/24/… ?Tracietracing
G
3

using PowerShell you can install the required feature with:

Add-WindowsFeature 'NET-HTTP-Activation'
Guard answered 21/4, 2015 at 15:38 Comment(0)
U
2

Order of installation matters a lot when configuring IIS 8 on Windows 8 or Windows Server 2012.

I faced lot of issues configuring IIS 8 but finally these links helped me

Unwrap answered 14/3, 2013 at 17:27 Comment(0)
D
2

On windows 10 (client) you can also script this using

Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName WCF-HTTP-Activation45 -All

Note that this is a different command from the server skus

Deprecative answered 6/9, 2016 at 20:22 Comment(0)
P
0

It's HTTP Activation feature of .NET framework Windows Process Activation feature is required too

Pompeii answered 31/10, 2015 at 16:50 Comment(1)
how do you do that?Samuel
W
0

This was a really silly one for me. Adding this here as it's one of the more popular threads on svc 404 issues.

I had in my Project Settings' \ Web \ Project URL, pasted:

http://blah.webservice.local.blahblah.com/Blah.svc

And for some unknown reason (having done this a thousand times) didn't spot straight away that the name of the .svc file was at the end.

DOH!

I had just pasted the address from my WCF test client and hadn't checked it sufficiently. What this did in the background was create an IIS application at the .svc address and I was getting nothing out of IIS. I couldn't work out how I couldn't even hit the .svc file.

Simple fix, obviously, just remove the application in IIS and change the project URL.

After almost 20 years at this, you can still make schoolboy errors / rookie mistakes. Hope this helps someone.

Weak answered 18/10, 2016 at 20:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.