There is a WCF REST service hosted in Windows Service or in command line executable. I would like to replace the default DataContractJsonSerializer with JSON.NET serializer.
There is a similar question with a minor difference, that it uses IIS: How to set Json.Net as the default serializer for WCF REST service.
Code proposed there does not work when hosted outside the IIS. It throws the following exception: 'ServiceHostingEnvironment.EnsureServiceAvailable' cannot be invoked within the current hosting environment. This API requires that the calling application be hosted in IIS or WAS.
Any idea?