8.7. 如何使用MapPoint3.0获得地图和方向?
这篇快速入门教程描述了如何使用MapPoint的Web服务,在PocketPC上获得特定位置的地图方向,如以下屏幕截图所示:
http://samples.gotdotnet.com/quickstart/CompactFramework/doc/mappointdirections.aspx
8.8. Is NTLM authentication supported by the .NET Compact Framework?
Using Digest authentication instead of Basic or NTLM authentication is the recommended solution. Digest authentication is supported by the .NET Compact Framework.
8.9. When using blocking Sockets, why does Send throw an InvalidOperationException when blocking is set to false?
There is a known issue with setting Blocking to false on a blocking socket. There are three paradigms when programming with sockets (both managed and native) and it is strongly recommended that developers use asynchronous I/O functions as a solution to this problem. Select is very inefficient in managed code, and the cost of the regular case exception is also high. The three paradigms are detailed below, with the last being the preferred method.
Use blocking calls on blocking sockets (i.e. send(), recv(), etc). This is the simplest method, and probably the most commonly used. The functions perform their operation synchronously, tying up the currently executing thread. This is most acceptable for clients, and multithreaded servers (Microsoft does not recommend using one thread per client because threads are very expensive on Windows). Note that though the operations may block for an unspecified period of time (i.e. until the operation can be completed), they will most often complete immediately.
Use non-blocking sockets in conjunction with select or poll. Use the same "blocking" functions, but put the socket in a special mode that prohibits it from blocking. In the cases when the function would block, it returns an error code (in managed code, this throws an exception). You can then use poll or select to wait until a point in time at which an operation would complete (select allows you to manage more than one socket, so you can handle multiple clients on only one thread), and then perform the operation. At the time these calls were created, there were no threads in operating systems, so this was the only way to do things. Using this mechanism has by far the absolute worst performance you could possibly get from socket programming. This problem is exacerbated in managed code, since you now expect an exception to be thrown, which is an even bigger performance hit.
Use asynchronous I/O functions on the socket. This is your best all around solution. It allows you to perform operations asynchronously, and you get notified by callbacks. In general, the performance is better than using non-blocking I/O with select, and this is the recommendation for how to do things (at least, in native code).
8.10. How do I create an http-server?
Get technical insight on the implementation of Mobile Web Server architecture. Understand use cases, the web server framework and future developments in the architecture:
http://msdn.microsoft.com/library/en-us/dnnetcomp/html/NETCFMA.asp
8.11. Why do I get an exception when calling SetSocketOption with ReuseAddress set?
This is a known issue in the version 1 of the .NET Compact Framework. To work around the issue, you can P/Invoke setsockopt with SO_REUSEADDR set to true.
8.12. Why do I get a socket error using SSL to communicate with a server via the WebRequest namespace?
There is a known issue in the .NET Compact Framework. You can work around this by setting HttpWebRequest.AllowStreamWriteBuffering to True and commenting out your setting of the ContentLength.
9. SQL CE 和 数据
9.1. 使用.net精简框架、SQL Server CE 和 复制 开发应用程序时,要注意些什么?
这篇文章详细讨论了这个问题:
http://msdn.microsoft.com/msdnmag/issues/03/09/datapoints/toc.asp
9.2. 如何在微软.net精简框架上使用合并复制(Merge Replication)?
这篇文章讨论了如何通过程序在.net精简框架的应用程序中调用合并、复制:
http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfmergereplication.asp
SQL Server CE是非常好的在设备上管理数据的工具,但在未复制到桌面机的SQL Server之前,它必须保留数据。使用合并、复制在设备上管理数据,然后当设备连接到桌面机时,再合并到桌面机的SQL Server的实例中。.net精简框架提供SqlCeReplication对象,可以通过程序实现数据的合并与复制。
http://samples.gotdotnet.com/quickstart/CompactFramework/doc/sqlcemergereplication.aspx
9.3. 如何将ADO.NET数据和XML绑定?
以下三个步骤:
根据提供的XML文件,建立一个XML Schema文件(.xsd)。
读取XML数据和它的schema,以便操作。
将XML保存会文件。 http://samples.gotdotnet.com/quickstart/CompactFramework/doc/adonetdatabinding.aspx
9.4. 如何建立SQL Server CE的数据库?
您可以使用.net精简框架在Windows CE.NET的设备上建立、管理SQL Server CE的数据库。这篇快速入门教程演示了如何实现它:
建立一个SQL CE数据库。
连接到SQL CE数据库。
在SQL CE的数据库中建立一个表。
插入一行数据到SQL CE数据库中。
http://samples.gotdotnet.com/quickstart/CompactFramework/doc/sqlcedbcreate.aspx