|
I have a C# application that references the MapPoint object model. I am using the Application object and not the MapPointControl object. This program was periodically generating an RPC Server exception.
The program opens a base map, reads several thousand records from a database table, and places pushpins on the base map corresponding to lat/lon values read from the database table. It then zooms to different locations, queries the pushpin records within the current view to get a count, and creates web pages for each of the locations. I set up a system timer to repeat the process at a user selected interval.
Initially I opened the base map when the program loaded and kept it open until the program exited. I would create my pushpin dataset every time the timer event fired and delete it when I was finished processing each iteration.
Sometimes the program would generate the RPC Server exception on the first iteration (timer event). Other times it would run fine for a dozen or so iterations and then generate the exception. I considered the possibility that one iteration may not be finished processing when it was time for the next iteration to start. However, I created a Monitor to avoid this. I also set the timer interval to a point where I was certain that this was not happening and I still periodically got the exception.
I changed my code so that it initializes the MapPoint.Application object and opens the base map every time the timer event fires. When I am finished processing the data for each iteration, I use the MapPoint.Application.Quit() function and then set the Application object and Map object to null. I know that this is probably not the most efficient technique but I have not seen the RPC server error since I made this change.
I realize that this reply is probably too late to help the original poster but I hope it can help someone in the future. |