I have a WCF rest service with two OperationContracts as follows:
[OperationContract]
[WebGet(UriTemplate = "ping/")]
Message PingServer();
[OperationContract]
[WebGet(UriTemplate = "files/")]
Message AddFile(string accessKey);
When I visit http://localhost/rest.svc/ping/ it works fine and if I visit http://localhost/rest.svc/files/ it works fine.
However, if I visit http://localhost/rest.svc directly, it throws the following error:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://tempuri.org/:IRest ----> System.InvalidOperationException: The operation 'AddFile' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.
I understand the error, but was wondering how to fix/suppress it so it shows the default WCF endpoint page. I am just using WCF for REST only.
Thanks!
Jeffrey Kevin Pry