I am running an ASP.Net application on Windows Server 2008 R2. I have a .NET Framework 4.5. When migrating from the .NET Framework v2.0 to v4.0, I began to experience random behavior from WCF.
My web service returns JSON. After restarting the IIS service, the service will return fully valid JSON approximately 3-5 times. After that, JSON becomes invalid. I checked what happens through the wire through Fiddler, as well as my own logs on the client application (Adobe AIR application that calls the service) and on the server itself.
Fiddler shows that the original response does indeed contain invalid JSON. It seems like some kind of random point in JSON, the JSON response starts to be written again !, rewriting what should be there, and creating garbled JSON in the process.
See this concatenation example:
{"responseCode":0,"actionCode":"OK","cdn{"responseCode":0, "actionCode".....
Notice how the "responseCode" (which should only appear at the beginning of the JSON response) reappears again in JSON. "cdn{"responseCode":0 , of course, invalid JSON.
I have tried many patches. I tried to run ServiceModelReg.exe and aspnet_regiis.exe from different frameworks and in different combinations. The same behavior. If I go back to the previous code under version v2.0 and switch App Pool back to v2.0, then everything will be fine.
I believe this is a bug in WCF. Any ideas?
The only regression that I have at the moment is to snatch WCF and switch to something like ServiceStack, where I can debug all the code if necessary.