Simple call to Web Service results in OutOfMemoryException

Hi Experts,

I have a very simple Windows Mobile 6.0 application that polls a WCF web service (basicHTTPBinding, using XML messaging, hoasted in a Windows Service) every 500ms (counted after the conclusion of each web service call). The function returns an array of enums (NEVER more than two enums returned at a time). The application runs just fine for a couple of minutes and then all of the sudden I get the dreaded OutOfMemoryException as I try to execute the web service call. It almost seems like the framework is grabbing memory to handle the sending and receiving of the web service messages and then it never frees it up again.

That's not it. I call Dispose in from_Closing. Please take a look at the function ValidateLicense. It starts a baground thread that keeps calling _webService.GetPendingActions over-and-over again (in order to test the issue), and therefore, I don't want to dispose of the client.

I fixed the problem but I don't understand why my fix is a fix. So instead of using NetCFSvcUtil.exe to generate the web service proxy objects, I simply used the "Add Web Reference" function built into VS2008 (on the client side) and my problem went away. Can you explain to me why?

0

axnst2Author Commented: 2014-01-16

Thank you, the explanation you posted regarding the bug in the NetCFSvcUtil utility explains why adding a "web reference" instead of using the NetCFSvcUtil utility fixed my OutOfMemoryException problem. It's sad that Microsoft obviously knows about this bug and has done nothing to fix it. This bug basically renders the utility useless.

0

axnst2Author Commented: 2014-01-16

Just as a side note, as an unexpected (but very welcome) side effect, changing from NetCFSvcUtil to the "Add Web Reference" method has DRASTICALLY improved the overall speed of my ENTIRE application, even parts that never even call the web service!!! :)