I am having issues consuming a WCF service in my C# console application.
This is the code I am using to consume the service.
WCFServiceReference.WCFInterfaceClient client = new WCFInterfaceClient(); try { WCFInterface x = client.WCFInterface(); } catch (Exception ex) { Console.WriteLine(ex); }
WCF Interface Code
public interface WCFInterface { [OperationContract] WCFInterface WCFInterface(); } [DataContract] public class WCFInterface { [DataMember] public string URI1 = ""; [DataMember] public string URI2 = ""; [DataMember] public string URI3 = ""; }
This then generates the following error within the service.
"Unexpected character encountered while parsing value: <. Path '', line 0, position 0."
Exception Detail:
{An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value:
<. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonTextReader.ReadInternal()
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
I can see that the error is being generated within my service, the problem I am having is that I don't know why it is being triggered.
When I run the service and invoke it manually using the Test Client in Visual Studio no error is produced and the process completes successfully.