Muxa
Muxa

Reputation: 5643

How to solve HTTP status 405 "Method Not Allowed" when calling Web Services

I've got a siluation where i need to access a SOAP web service with WSE 2.0 security. I've got all the generated c# proxies (which are derived from Microsoft.Web.Services2.WebServicesClientProtocol), i'm applying the certificate but when i call a method i get an error:

System.Net.WebException : The request failed with HTTP status 405: Method Not Allowed.
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

I've done some googling and it appears that this is a server configuration issue. However this web service is used many clients without any problem (the web service is provided by a Telecom New Zealand, so it's bound to be configured correctly. I believe it's written in Java)

Can anyone shed some light on this issue?

Upvotes: 20

Views: 111271

Answers (7)

Diego Elizondo
Diego Elizondo

Reputation: 41

You needto enable HTTP Activation

Go to Control Panel > Windows Features > .NET Framework 4.5 Advanced Services > WCF Services > HTTP Activation

Upvotes: 4

StanT.
StanT.

Reputation: 320

In my case the problem was that the app config was incorrectly formed/called: in config the service url was using "localhost" as domain name, but real hostname differed from the URL I called :( so I changed the "localhost" in config to domainname thah I use in URL. That`s all!

Upvotes: 0

user1551704
user1551704

Reputation: 94

MethodNotAllowedEquivalent to HTTP status 405. MethodNotAllowed indicates that the request method (POST or GET) is not allowed on the requested resource.

The problem is in your enpoint uri is not full or correct addres to wcf - .scv Check your proxy.enpoint or wcf client.enpoint uri is correct.

Upvotes: 0

A-Dubb
A-Dubb

Reputation: 1709

I found this was due to WCF not being installed on IIS. The main thing is that the .svc extension has to be mapped in IIS See MSDN here. Use the ServiceModelReg tool to complete the installation. You'll always want to verify that WCF is installed and .svc is mapped in IIS anytime you get a new machine or reinstall IIS.

Upvotes: 5

Juan Calero
Juan Calero

Reputation: 4224

I had the same problem, but the details were different:

The Url we were using didn't have the file (.asmx) part. Calling the Url in a browser was OK. It also worked in a simple client setting the URL through Visual Studio. But it didn't worked setting the Url dynamically! It gave the same 405 error.

Finally we found that adding the file part to the Web Service Url solved the problem. Maybe a .Net framework bug?

Upvotes: 4

Muxa
Muxa

Reputation: 5643

Ok, found what the problem was. I was trying to call a .wsdl url instead of .asmx url. Doh!

Upvotes: 20

cruizer
cruizer

Reputation: 6151

hmm are those other clients also using C#/.NET?

Method not allowed --> could this be a REST service, instead of a SOAP web service?

Upvotes: 0

Related Questions