This is my first attempt at a service via WCF which is hosted in a Windows Service. I have noticed that if I do something incorrectly in the UriTemplate it completely breaks everything and I don't know why.
Example:
In the first code example everything works fine. The service waits on my defined base address and returns the information I expect.
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "/GetDetail?id={id}", BodyStyle = WebMessageBodyStyle.WrappedResponse, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
MyDetail GetDetail(int id);
}
In this example where I have changed the UriTemplate = "/GetDetail?id={id}"
to UriTemplate = "/GetDetail/{id}"
everything breaks. The service doesn't even wait on my configured base address.
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "/GetDetail/{id}", BodyStyle = WebMessageBodyStyle.WrappedResponse, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
MyDetail GetDetail(int id);
}
I don't understand how this change can cause everything to fail? Shouldn't it just fail to work on that GetDetail call and not break the whole system?
Also to expand on this how can I add logging to my service.