.NET Framework 中的网络编程Network Programming in the .NET Framework

Microsoft .NET Framework 为 Internet 服务提供了一种分层、可扩展且托管的实现,可以快速、轻松地将其集成到你的应用程序中。The Microsoft .NET Framework provides a layered, extensible, and managed implementation of Internet services that can be quickly and easily integrated into your applications. 你的网络应用程序可以基于可插入协议而构建,以便自动利用新的 Internet 协议,或者,它们可以使用 Windows 套接字接口的托管实现在套接字级别上使用网络。Your network applications can build on pluggable protocols to automatically take advantage of new Internet protocols, or they can use a managed implementation of the Windows socket interface to work with the network on the socket level.

本节内容In This Section

可插入协议简介Introducing Pluggable Protocols
描述如何访问 Internet 资源而不考虑它所需的访问协议。Describes how to access an Internet resource without regard to the access protocol that it requires.

请求数据Requesting Data
说明如何使用可插入协议上载数据和从 Internet 资源下载数据。Explains how to use pluggable protocols to upload and download data from Internet resources.

对可插入协议进行编程Programming Pluggable Protocols
说明如何派生协议特定的类以实现可插入协议。Explains how to derive protocol-specific classes to implement pluggable protocols.

使用应用程序协议Using Application Protocols
描述利用 TCP、UDP 和 HTTP 等网络协议的编程应用程序。Describes programming applications that take advantage of network protocols such as TCP, UDP, and HTTP.

Internet 协议版本 6Internet Protocol Version 6
描述 Internet 协议版本 6 (IPv6) 相对于当前的 Internet 协议套件版本 (IPv4) 的优势,描述 IPv6 寻址、路由和自动配置,以及如何启用和禁用 IPv6。Describes the advantages of Internet Protocol version 6 (IPv6) over the current version of the Internet Protocol suite (IPv4), describes IPv6 addressing, routing and auto-configuration, and how to enable and disable IPv6.

配置 Internet 应用程序Configuring Internet Applications
说明如何使用 .NET Framework 配置文件来配置 Internet 应用程序。Explains how to use the .NET Framework configuration files to configure Internet applications.

.NET Framework 中的网络跟踪Network Tracing in the .NET Framework
说明如何使用网络跟踪来获取有关方法调用的信息,以及有关托管应用程序所生成网络流量的信息。Explains how to use network tracing to get information about method invocations and network traffic generated by a managed application.

网络应用程序的缓存管理Cache Management for Network Applications
描述如何使用应用程序(采用 System.Net.WebClientSystem.Net.WebRequestSystem.Net.HttpWebRequest 类)的缓存。Describes how to use caching for applications that use the System.Net.WebClient, System.Net.WebRequest, and System.Net.HttpWebRequest classes.

网络编程中的安全性Security in Network Programming
描述如何使用 Internet 标准安全性和身份验证方法。Describes how to use standard Internet security and authentication techniques.

System.Net 类的最佳实践Best Practices for System.Net Classes
提供关于如何充分利用 Internet 应用程序的提示和技巧。Provides tips and tricks for getting the most out of your Internet applications.

通过代理访问 InternetAccessing the Internet Through a Proxy
描述如何配置代理。Describes how to configure proxies.

NetworkInformationNetworkInformation
描述如何收集有关网络事件、更改、统计信息和属性的信息,并说明如何使用 System.Net.NetworkInformation.Ping 类确定远程主机是否可到达。Describes how to gather information about network events, changes, statistics, and properties and also explains how to determine whether a remote host is reachable by using the System.Net.NetworkInformation.Ping class.

对 2.0 版中的 System.Uri 命名空间的更改Changes to the System.Uri namespace in Version 2.0
描述在版本 2.0 中对 System.Uri 类做出的一些更改,这些更改用于修复错误行为、增强可用性和安全性。Describes several changes made to the System.Uri class in Version 2.0 to fixed incorrect behavior, enhance usability, and enhance security.

System.Uri 中的国际资源标识符支持International Resource Identifier Support in System.Uri
描述在版本 3.5、3.0 SP1 和 2.0 SP1 中对 System.Uri 类进行的增强,这些增强用于提供国际资源标识符 (IRI) 和国际化域名 (IDN) 支持。Describes enhancements to the System.Uri class in Version 3.5, 3.0 SP1, and 2.0 SP1 for International Resource Identifier (IRI) and Internationalized Domain Name (IDN) support.

版本 3.5 中的套接字性能增强Socket Performance Enhancements in Version 3.5
描述在版本 3.5、3.0 SP1 和 2.0 SP1 中对 System.Net.Sockets.Socket 类做出的一系列增强,这些增强提供了一种可供专用高性能套接字应用程序使用的替代异步模式。Describes a set of enhancements to the System.Net.Sockets.Socket class in Version 3.5, 3.0 SP1, and 2.0 SP1 that provide an alternative asynchronous pattern that can be used by specialized high-performance socket applications.

对等名称解析协议Peer Name Resolution Protocol
描述在版本 3.5 中添加的支持,它们用于支持对等名称解析协议 (PNRP)、一种无服务器和动态名称注册及名称解析协议。Describes support added in Version 3.5 to support the Peer Name Resolution Protocol (PNRP), a serverless and dynamic name registration and name resolution protocol. 这些新功能由 System.Net.PeerToPeer 命名空间提供支持。These new features are supported by the System.Net.PeerToPeer namespace.

对等协作Peer-to-Peer Collaboration
描述在版本 3.5 中添加的支持,它们用于支持基于 PNRP 而构建的对等协作。Describes support added in Version 3.5 to support the Peer-to-Peer Collaboration that builds on PNRP. 这些新功能由 System.Net.PeerToPeer.Collaboration 命名空间提供支持。These new features are supported by the System.Net.PeerToPeer.Collaboration namespace.

3.5 SP1 版本中对 HttpWebRequest 的 NTLM 身份验证的更改Changes to NTLM authentication for HttpWebRequest in Version 3.5 SP1
描述在版本 3.5 SP1 中做出的安全性更改,这些更改可影响以下类处理集成式 Windows 身份验证的方式: System.Net.HttpWebRequestSystem.Net.HttpListenerSystem.Net.Security.NegotiateStream,以及 System.Net 命名空间中的相关类。Describes security changes made in Version 3.5 SP1 that affect how integrated Windows authentication is handled by the System.Net.HttpWebRequest, System.Net.HttpListener, System.Net.Security.NegotiateStream, and related classes in the System.Net namespace.

带有扩展保护的集成 Windows 身份验证Integrated Windows Authentication with Extended Protection
描述扩展保护方面的增强,这些增强可影响以下类处理集成式 Windows 身份验证的方式: System.Net.HttpWebRequestSystem.Net.HttpListenerSystem.Net.Mail.SmtpClientSystem.Net.Security.SslStreamSystem.Net.Security.NegotiateStream以及 System.Net 和相关命名空间中的相关类。Describes enhancements for extended protection that affect how integrated Windows authentication is handled by the System.Net.HttpWebRequest, System.Net.HttpListener, System.Net.Mail.SmtpClient, System.Net.Security.SslStream, System.Net.Security.NegotiateStream, and related classes in the System.Net and related namespaces.

使用 IPv6 和 Teredo 的 NAT 遍历NAT Traversal using IPv6 and Teredo
描述添加到 System.NetSystem.Net.NetworkInformationSystem.Net.Sockets 命名空间的增强,这些增强用于支持使用 IPv6 和 Teredo 进行 NAT 遍历。Describes enhancements added to the System.Net, System.Net.NetworkInformation, and System.Net.Sockets namespaces to support NAT traversal using IPv6 and Teredo.

Windows 应用商店应用的网络隔离Network Isolation for Windows Store Apps
描述当在 System.Net应用中使用 System.Net.HttpSystem.Net.Http.HeadersWindows 8.x 应用商店Windows 8.x Store 命名空间中的类时,网络隔离所产生的影响。Describes the impact of network isolation when classes in the System.Net, System.Net.Http, and System.Net.Http.Headers namespaces are used in Windows 8.x 应用商店Windows 8.x Store apps.

网络编程示例Network Programming Samples
可下载网络编程示例的链接,这些示例使用 System.NetSystem.Net.CacheSystem.Net.ConfigurationSystem.Net.MailSystem.Net.MimeSystem.Net.NetworkInformationSystem.Net.PeerToPeerSystem.Net.SecuritySystem.Net.Sockets 命名空间中的类。Links to downloadable network programming samples that use classes in the System.Net, System.Net.Cache, System.Net.Configuration, System.Net.Mail, System.Net.Mime, System.Net.NetworkInformation, System.Net.PeerToPeer, System.Net.Security, System.Net.Sockets namespaces.

参考Reference

System.Net
为当前网络采用的多种协议提供简单的编程接口。Provides a simple programming interface for many of the protocols used on networks today. 此命名空间中的 System.Net.WebRequestSystem.Net.WebResponse 类是可插入协议的基础。The System.Net.WebRequest and System.Net.WebResponse classes in this namespace are the basis for pluggable protocols.

System.Net.Cache
定义一些类型和枚举,这些类型和枚举用于为通过 System.Net.WebRequestSystem.Net.HttpWebRequest 类获取的资源制定缓存策略。Defines the types and enumerations used to define cache policies for resources obtained using the System.Net.WebRequest and System.Net.HttpWebRequest classes.

System.Net.Configuration
应用程序以编程方式访问和更新 System.Net 命名空间的配置设置时所使用的类。Classes that applications use to programmatically access and update configuration settings for the System.Net namespaces.

System.Net.Http
用于为现代 HTTP 应用程序提供编程接口的类。Classes that provides a programming interface for modern HTTP applications.

System.Net.Http.Headers
System.Net.Http 命名空间使用的 HTTP 标头集合提供支持。Provides support for collections of HTTP headers used by the System.Net.Http namespace

System.Net.Mail
使用 SMTP 协议撰写和发送邮件时所使用的类。Classes to compose and send mail using the SMTP protocol.

System.Net.Mime
定义一些类型,这些类型用于表示供 System.Net.Mail 命名空间中的类所使用的多用途 Internet 邮件交换 (MIME) 标头。Defines types that are used to represent Multipurpose Internet Mail Exchange (MIME) headers used by classes in the System.Net.Mail namespace.

System.Net.NetworkInformation
用于以编程方式收集有关网络事件、更改、统计信息和属性的信息的类。Classes to programmatically gather information about network events, changes, statistics, and properties.

System.Net.PeerToPeer
为开发人员提供对等名称解析协议 (PNRP) 的一种托管实现。Provides a managed implementation of the Peer Name Resolution Protocol (PNRP) for developers.

System.Net.PeerToPeer.Collaboration
为开发人员提供对接协作接口的一种托管实现。Provides a managed implementation of the Peer-to-Peer Collaboration interface for developers.

System.Net.Security
用于为主机间的安全通信提供网络流的类。Classes to provide network streams for secure communications between hosts.

System.Net.Sockets
为需要帮助控制网络访问的开发人员提供 Windows 套接字 (Winsock) 接口的一种托管实现。Provides a managed implementation of the Windows Sockets (Winsock) interface for developers who need to help control access to the network.

System.Net.WebSockets
为开发人员提供 WebSocket 接口的一种托管实现。Provides a managed implementation of the WebSocket interface for developers.

System.Uri
提供统一资源标识符 (URI) 的对象表示形式和对 URI 各部分的轻松访问。Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.

System.Security.Authentication.ExtendedProtection
为采用应用程序扩展保护的身份验证提供支持。Provides support for authentication using extended protection for applications.

System.Security.Authentication.ExtendedProtection.Configuration
为配置采用应用程序扩展保护的身份验证提供支持。Provides support for configuration of authentication using extended protection for applications.

请参阅See also