(405) Method Not Allowed. WCF WebService
Asked Answered
P

1

20

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.

Putscher answered 1/3, 2016 at 13:25 Comment(0)
S
59

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.

Stogy answered 1/3, 2016 at 13:48 Comment(6)
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!Putscher
I'm happy that this helpedStogy
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 :-)Landel
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!Podite
Thank you, sir! Adding HTTP Activation on Server 2016 was the fix for me too.Icarus
this didn't work for me. I continue to get 500 errors 'cannot be activated due to an exception during compilation" see here #74380963Osugi

© 2022 - 2024 — McMap. All rights reserved.