6

I have the following WCF :

    [OperationContract]
    IList<OperationRoomDto> GetOperationRooms();

and I have a website that uses this WCF, when I use Visual studio (Asp.Net development server) it works fine, but when I deploy the WCF to IIS I get this exception:

The remote server returned an error: (405) Method Not Allowed.

I made a simple website to test this WCF (on IIS) and It worked.

this is a part of the website web.config file:

  <endpoint address="http://server/WcfService"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMessageService"
            contract="MyProject.Web.Wcf.IMessageService" name="BasicHttpBinding_IMessageService">
  </endpoint>

and this part of the web service config file:

  <system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="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" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

I tried to debug the w3wp.exe service to get any hidden exception,I put a break point at the web service methods, but the debugger didn't even reach there, and the exception happened before reaching to the web service class.

Nour
  • 4,530
  • 3
  • 35
  • 58
  • I had a similar issue and the solution was [turning on HTTP Activation](https://stackoverflow.com/a/12519582/2546759) from windows features. – Nir Mar 14 '21 at 10:14
  • When I had this problem the solution was [turning on HTTP Activation](https://stackoverflow.com/a/12519582/2546759). – Nir Mar 14 '21 at 10:24

1 Answers1

12

I figured out the problem, it was because the Url of the wcf is not correct, it misses the service file name

<endpoint address="http://server/WcfService"

it should become :

<endpoint address="http://server/WcfService/Service.svc"
Nour
  • 4,530
  • 3
  • 35
  • 58
  • 1
    NOOOOOOOOOOOOOOOOOOOOOOOO!!! I have spent literally *hours* trying to sort this out, and this turned out to be the problem. THANK YOU :) – Steve Wilkes Jul 31 '13 at 13:26
  • 1
    :) I'm glad that your problem is solved, it took me a lot of time too to solve it. – Nour Jul 31 '13 at 19:59