WCF Service Returning "Method Not Allowed"


In the process of developing my first WCF service and when I try to use it I get "Method not Allowed" with no other explanation.

I've got my interface set up with the ServiceContract and OperationContract:

    void FileUpload(UploadedFile file);

Along with the actual method:

    public void FileUpload(UploadedFile file) {};

To access the Service I enter http://localhost/project/myService.svc/FileUpload but I get the "Method not Allowed" error

Am I missing something?

This question is tagged with .net wcf web-services

~ Asked on 2008-09-03 04:03:49

9 Answers


Your browser is sending an HTTP GET request: Make sure you have the WebGet attribute on the operation in the contract:

public interface IUploadService
    string TestGetMethod(); // This method takes no arguments, returns a string. Perfect for testing quickly with a browser.

    void UploadFile(UploadedFile file); // This probably involves an HTTP POST request. Not so easy for a quick browser test.

~ Answered on 2009-02-13 12:34:26


If you are using the [WebInvoke(Method="GET")] attribute on the service method, make sure that you spell the method name as "GET" and not "Get" or "get" since it is case sensitive! I had the same error and it took me an hour to figure that one out.

~ Answered on 2010-01-07 05:08:07


The basic intrinsic types (e.g. byte, int, string, and arrays) will be serialized automatically by WCF. Custom classes, like your UploadedFile, won't be.

So, a silly question (but I have to ask it...): is UploadedFile marked as a [DataContract]? If not, you'll need to make sure that it is, and that each of the members in the class that you want to send are marked with [DataMember].

Unlike remoting, where marking a class with [XmlSerializable] allowed you to serialize the whole class without bothering to mark the members that you wanted serialized, WCF needs you to mark up each member. (I believe this is changing in .NET 3.5 SP1...)

A tremendous resource for WCF development is what we know in our shop as "the fish book": Programming WCF Services by Juval Lowy. Unlike some of the other WCF books around, which are a bit dry and academic, this one takes a practical approach to building WCF services and is actually useful. Thoroughly recommended.

~ Answered on 2008-09-03 05:23:37


I ran into this exact same issue today. I had installed IIS, but did not have the activate WCF Services Enabled under .net framework 4.6.

enter image description here

~ Answered on 2020-06-06 21:57:05


I've been having this same problem for over a day now - finally figured it out. Thanks to @Sameh for the hint.

Your service is probably working just fine. Testing POST messages using the address bar of a browser won't work. You need to use Fiddler to test a POST message.

Fiddler instructions... http://www.ehow.com/how_8788176_do-post-using-fiddler.html

~ Answered on 2014-12-03 00:16:57


It sounds like you're using an incorrect address:

To access the Service I enter http://localhost/project/myService.svc/FileUpload

Assuming you mean this is the address you give your client code then I suspect it should actually be:


~ Answered on 2008-09-03 08:04:37


My case: configuring the service on new server. ASP.NET 4.0 was not installed/registered properly; svc extension was not recognized.

~ Answered on 2015-06-09 13:07:24


you need to add in web.config

<endpoint address="customBinding" binding="customBinding" bindingConfiguration="basicConfig" contract="WcfRest.IService1"/>  

        <binding name="basicConfig">  
            <httpTransport transferMode="Streamed" maxReceivedMessageSize="67108864"/>  

~ Answered on 2012-08-22 18:31:45


Only methods with WebGet can be accessed from browser IE ; you can access other http verbs by just typing address

You can either try Restful service startup kit of codeples or use fiddler to test your other http verbs

~ Answered on 2011-01-20 20:16:52

Most Viewed Questions: