0

I can access my WCF service and obtain its WSDL file but can't access a "subdirectory" to it. The error recieved is as follows when I type in the URL in the address line.

[14:42:45.509] GET http://---.azurewebsites.net/MyService.svc/Ping [HTTP/1.1 400 Bad Request 105ms]

The interface and implementation is as follows.

[OperationContract]
[WebGet(UriTemplate="Ping")]
String Ping();

public String Ping() { return "Pong"; }

The service model in the config file consists of the following section.

Behaviors

<behaviors>
  <endpointBehaviors>
    <behavior name="PingEndPointBehavior">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name ="PingServiceBehavior">
      <serviceMetadata httpGetEnabled="true" 
                       httpsGetEnabled="true"/>
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" 
                       httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

Bindings

<bindings>
  <basicHttpBinding>
    <binding name="PingBasicHttpBinding"/>
  </basicHttpBinding>
</bindings>

Services

<services>
  <service name="MyNamespace.MyService" 
           behaviorConfiguration="PingServiceBehavior">
    <endpoint name="PingEndpoint" 
              behaviorConfiguration="PingEndPointBehavior" 
              address="Ping" 
              bindingConfiguration="PingBasicHttpBinding" 
              contract="MyNamespace.IMyService"/>
  </service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" 
                           multipleSiteBindingsEnabled="true"/>

What am I missing?

Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438

1 Answers1

1

I guess you cannot type the URL and get a response from your WCF service using BasicHttpBinding. You should use webHttpBinding for the above to work

Rajesh
  • 7,766
  • 5
  • 22
  • 35
  • I corrected the mistake but I'm not sure if I resolved the problem or just swept it under the carpet, because now I get that the end point is not found. I posted a [related question here](http://stackoverflow.com/questions/17165275/endpoint-not-found-when-accessing-via-url-in-a-browser) but this far, nobody has come up with even a single comment, which worries me. Feel free to take a whack at it. I'll probably be giving away some bounty on this one because it's very important to me. :) – Konrad Viltersten Jun 18 '13 at 12:58