19

Introduction:

Hello, I am trying to set up a WCF web service on my local IIS 7.5 server, however after I finish the basic configurations I am unable to send data with a WinForms test client and it returns the error mentioned in the titles. I have already searched similar threads on this problem but i did not find anything that would fit my problem.

Data:

-Both the Wcf WebService and the test client where provided from a 3rd party

-They already work on another server and I am using the same versions

-I am probably doing something wrong when I enable or configure IIS

Request:

-I need to know what IIS features I need to enable/disable in order to install it correctly so I can use the Wcf WebService.(If that's the case).

-How to correctly configure the server in order to solve the above mentioned error.

My Configurations:

-After Installing IIS I changed the DefaulAppPool to .NET Framework v4.0.30.319; pipeline mode: Integrated. -Advanced Settings: Load User profile = False.

-Created a new Website named "WcfMicrocontrollerService" using DefaultAppPool.Binding; Type:http, IP adress: , port: 80

At this point I can access it trough a web browser, however when I use the test client to POST data to the service I get the following error: "The remote server returned an unexpected response:(405) Method Not Allowed."

Here are the data packets sent as recorded by Fiddler: Sent:

POST http://192.168.0.102/MicroControllerComSvc.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/IMicroControllerComSvc/GetMicrocontrollerData"
Host: 192.168.0.102
Content-Length: 237
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetMicrocontrollerData xmlns="http://tempuri.org/"><microControllerData>1,1,1,1,2,2,1,0,100,300</microControllerData></GetMicrocontrollerData></s:Body></s:Envelope>

Received:

HTTP/1.1 405 Method Not Allowed
Cache-Control: private
Allow: GET, HEAD, OPTIONS, TRACE
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 01 Mar 2016 10:44:44 GMT
Content-Length: 5671

And here's the body: https://dl.dropboxusercontent.com/u/2237590/405.html

This seems to indicate that I should take a look in handler mappings but I have no idea what to edit there.

Grossu Iulian
  • 255
  • 1
  • 2
  • 9

1 Answers1

51

Ok so after a very brief search about your issue I found the following question WCF on IIS8; *.svc handler mapping doesn't work

Ignoring the fact that the question is about IIS 8, are you running Windows or Windows Server?

If you are using Windows go to...

  • Control Panel -> Programs -> Programs and Features > Turn Windows Features on or off. Under the ".Net Framework 3.5 (Invlucdes .NET 2.0 and 3.0" section
  • make sure that "Windows Communication Foundation HTTP Activation" is turned on.
  • Also check under ".NET Framerwork 4.x Advanced Services" and under "WCF Services" check to ensure that HTTP Activation is turned on there as well.

This is a picture from that question showing the .net 4.5 change to make. Features to turn on

If you are using Windows Server try following the first answer to the question regarding how to set up the role using server manager.

Community
  • 1
  • 1
simlawstu
  • 526
  • 5
  • 4
  • I have managed to get the Web service working on another machine that had Windows 10(IIS 10) installed and your instructions where applicable. However under Windows 7 SP1 I have only the .Net Framework 3.5 option and I get the 500.21 error after I enable HTTP Activation but i am not stuck anymore and should be able to solve the problem on my own. I was looking in the wrong place and would of never figured this out. Thank you so much! – Grossu Iulian Mar 01 '16 at 14:25
  • I'm happy that this helped – simlawstu Apr 13 '16 at 14:47
  • That really helped - worked fine under Server 2016 Preview 5 - I think that installed just about every feature by default. After a clean install of Server 2016 Standard this bit was driving me nuts and we all know how stressful that is when working to a schedule :-) – gchq Oct 30 '16 at 14:45
  • 1
    Installing HTTP activation fixed the 405 error I was getting after I had moved the WCF to a new web server with HTTP activation not installed. Thanks! – IanK.CO Feb 23 '18 at 16:42
  • Thank you, sir! Adding HTTP Activation on Server 2016 was the fix for me too. – Christopher D. Emerson Sep 11 '19 at 12:55