I know there are few articles on the internet (including here), but after few hours, still can not find the solution to a problem. I have a service for uploading files to the server. And I am getting http error 405, method not allowed. Tried everything without a success so far. Below is the code of service.

**Service contract:**

```
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract(Name = "ExcelUpload.IUploadFile")]
public interface IUploadFile
{
    [OperationContract]
    [DataContractFormat]
    [WebInvoke(Method = "POST",
               UriTemplate = "Upload/",
               BodyStyle = WebMessageBodyStyle.Bare,
               ResponseFormat = WebMessageFormat.Json)]
    ReturnValue FileUpload(Stream File);
    // TODO: Add your service operations here
}

// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class ReturnValue
{
    [DataMember]
    public bool IsSuccessfull { get; set; }
}

```

**Service class:**

```
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple,
             InstanceContextMode = InstanceContextMode.PerCall,
             IgnoreExtensionDataObject = true,
             IncludeExceptionDetailInFaults = true)]
public class UploadFile : IUploadFile
{
    public ReturnValue FileUpload(Stream File)
    {
        using(FileStream writer = new FileStream(@"C:\temp", FileMode.Create))
        {
            int ReadCount = 0;
            var buffer = new byte[8192];
            while ((ReadCount = File.Read(buffer, 0, buffer.Length)) != 0)
            {
                writer.Write(buffer, 0, ReadCount);
            }
        }

        return new ReturnValue() { IsSuccessfull = true };
    }
}

```

**Web config**

```
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
      <serviceActivations>
        <add relativeAddress="~/UploadFile.svc" service="ExcelUpload.UploadFile"/>
      </serviceActivations>
    </serviceHostingEnvironment>
    <bindings>
      <webHttpBinding>
        <binding name="crossDomain"
                 maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647"
                 maxReceivedMessageSize="2147483647"
                 transferMode="Streamed"
                 sendTimeout="00:05:00" 
                 crossDomainScriptAccessEnabled="true">
          <readerQuotas  maxDepth="2147483647"
                         maxStringContentLength="2147483647"
                         maxArrayLength="2147483647"
                         maxBytesPerRead="2147483647"
                         maxNameTableCharCount="2147483647"/>
          <security mode="None" />
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="defaultServiceBehaviour">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>s
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
        </behavior>
      </serviceBehaviors>

      <endpointBehaviors>
        <behavior name="defaultEndpointBehaviour">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service name="ExcelUpload.UploadFile"  behaviorConfiguration="defaultServiceBehaviour">
        <endpoint address="" behaviorConfiguration="defaultEndpointBehaviour" bindingConfiguration="crossDomain" binding="webHttpBinding" contract="ExcelUpload.IUploadFile"></endpoint>
      </service>
    </services>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

```

**Corrections to web.config**

```
<security>
  <requestFiltering allowHighBitCharacters="true">
    <verbs allowUnlisted="false">
      <add verb="POST" allowed="true"/>
      <add verb="GET" allowed="true"/>
    </verbs>
  </requestFiltering>
</security>

```