I am running an ASP.Net app on Windows Server 2008 R2. I have up to .NET Framework 4.5 installed. Upon migrating from .NET Framework v2.0 to v4.0 I began to experience random behavior from WCF.
My web service returns JSON. Upon restarting IIS the service will return perfectly valid JSON about 3 to 5 times. After that, the JSON becomes invalid. I have inspected what is coming across the wire via Fiddler and also my own logs on both client app (an Adobe AIR app that calls the service) and on the server itself.
Fiddler shows that the raw response does in fact contain invalid JSON. It appears very much that a some random point in the JSON the response JSON begins to get written out again!, overwriting what should be there and producing mangled JSON in the process.
See this concatenated example:
{"responseCode":0,"actionCode":"OK","cdn{"responseCode":0, "actionCode".....
Note how "responseCode" (which should only appear at the beginning of the JSON response) suddenly appears again in the JSON further on. "cdn{"responseCode":0
is of course invalid JSON.
I have tried numerous patches. I've tried running ServiceModelReg.exe
and aspnet_regiis.exe
from under different frameworks and in different combinations. Same behavior. If I revert to previous code under v2.0 and switch the App Pool back to v2.0 then everything works fine.
I believe this to be a bug deep in WCF. Any ideas?
The only recourse I have at this point is to rip out WCF and switch to something like ServiceStack where I can debug into all the code if necessary.