successful ISS configuration for "GET" Method but not for "POST" Method. (method not found error)
A wfc rest service but i get method not found error. I also have som "GET" methods that work fine..
Interface:
[ServiceContract] public interface INavigatorWebService { [OperationContract] ApiReturn GetApiAlive(string apikey); [OperationContract] BookingData PostBookingData(BookingFields incomingFields); }
[DataContract] public class BookingFields { [DataMember(Name = "registrationNumber", EmitDefaultValue = false)] public string registrationNumber { get; set; } [DataMember(Name = "vehicleMake", EmitDefaultValue = false)] public string vehicleMake { get; set; } [DataMember(Name = "vehicleModel", EmitDefaultValue = false)] public string vehicleModel { get; set; } }
Service:
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "PostBookingData")] public BookingData PostBookingData(BookingFields incomingFields) { // }
Web Config:
<?xml version="1.0"?><configuration><system.serviceModel><services><service name="DmsNavigator.NavigatorWebService" behaviorConfiguration="DmsNavigatorServiceBehaviour"><host><baseAddresses><add baseAddress="http://webservice.dmservices.co.uk" /></baseAddresses></host><endpoint name="epcfg" address="http://webservice.dmservices.co.uk/DmsNavigator.NavigatorWebService.svc" behaviorConfiguration="DmsNavigatorServiceEndPointBehaviour" binding="webHttpBinding" contract="DmsNavigator.INavigatorWebService"/></service></services><behaviors><serviceBehaviors><behavior name="DmsNavigatorServiceBehaviour"><serviceMetadata httpGetEnabled="true"/></behavior></serviceBehaviors><endpointBehaviors><behavior name="DmsNavigatorServiceEndPointBehaviour"><webHttp /></behavior></endpointBehaviors></behaviors></system.serviceModel></configuration>
thanks in advance