WCF JSON Service not exposing methods

I am trying to create a WCF Service that returns a JSON Object. My first problem is that I am not seeing the service method exposed to even call it. When I call the service method like this... "http://localhost:60090/VehicleDataService/detailbydivision?divisionId=1&year=2012", I get a 404 error.

Web.Config....

    <system.serviceModel>
    <services>
      <service name="GMEOG.VehicleDataService" behaviorConfiguration="metadataBehavior">
        <endpoint address="" binding="webHttpBinding" contract="GMEOG.IVehicleDataService" behaviorConfiguration="VehicleDataServiceBehavior">
          <identity>
            <dns value="" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="metadataBehavior">
          <!-- 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>

      <endpointBehaviors>
        <behavior name="VehicleDataServiceBehavior">
          <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" />
        </behavior>
      </endpointBehaviors>
    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

  </system.serviceModel>
 <system.webServer>
   <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

Here is my Interface....

[ServiceContract(Namespace = "GMEOG.VehicleDataService", Name = "VehicleDataService")]
public interface IVehicleDataService

{
[OperationContract]
[WebInvoke(Method = "GET",
           ResponseFormat = WebMessageFormat.Json,
           RequestFormat = WebMessageFormat.Json,
           BodyStyle = WebMessageBodyStyle.WrappedResponse,
           UriTemplate = "DetailByDivision?divisionId={divisionId}&year={year}")]
[return: MessageParameter(Name = "Vehicle")]
List<Vehicle> DetailByDivision(string divisionId, string year);


}

Answers


How are you defining your service file? Using a .svc file or using routing?

If the former (assuming a svc file called "VehicleDataService.svc"), the address should be http://localhost:60090/VehicleDataService.svc/detailbydivision?divisionId=1&year=2012.

If the latter, please update your post how you're using the routing service.

If something else, please state on the question as well.


Try to add Host to your service endpoint in web.config:

<host>
  <baseAddresses>
    <add baseAddress="http://localhost:60090/VehicleDataService" />
  </baseAddresses>
</host>

Need Your Help

used NSString object in another file shown always null value ?

iphone ios7 nsstring xcode5

i have two .m file .i used nsstring object on another .m file its always null.

Regular expression search in Visual studio

regex visual-studio-2008 search pattern-matching

The code that I am working with has tons of style that I want to remove. Here is the code snippet