<system.Net> 元素(网络设置)

更新:2007 年 11 月

包含指定 .NET Framework 与网络的连接方式的设置。

<configuration> 元素
  <system.Net> 元素(网络设置)

<system.net> 
</system.net>

属性和元素

以下几节描述了属性、子元素和父元素。

属性

无。

子元素

元素

说明

authenticationModules

指定用于对 Internet 请求进行身份验证的模块。

connectionManagement

指定与 Internet 宿主的连接的最大数目。

defaultProxy

配置超文本传输协议 (HTTP) 代理服务器。

mailSettings

配置简单邮件传输协议 (SMTP) 邮件发送选项。

requestCaching

控制网络请求的缓存机制。

settings

配置 System.Net 的基本网络选项。

<webRequestModules> 元素(网络设置)

指定用于从 Internet 宿主请求信息的模块。

父元素

元素

说明

configuration

包含所有命名空间的设置。

备注

system.net 元素包含 System.Net 命名空间中的类的设置。这些设置为从 Internet 宿主接收信息配置身份验证模块、连接管理、代理服务器和 Internet 请求模块。

示例

下面的代码示例演示 System.Net 类使用的典型配置。

<configuration>
  <system.net>
    <authenticationModules>
      <add type = "System.Net.DigestClient" />
      <add type = "System.Net.NegotiateClient" />
      <add type = "System.Net.KerberosClient" />
      <add type = "System.Net.NtlmClient" />
      <add type = "System.Net.BasicClient" />
    </authenticationModules>
    <connectionManagement>
      <add address = "*" maxconnection = "2" />
    </connectionManagement>
    <defaultProxy>
      <proxy
        usesystemdefault = "true"
        bypassonlocal = "true"
      />
    </defaultProxy>
    <webRequestModules>
      <add prefix = "http"
        type = "System.Net.HttpRequestCreator"
      />
      <add prefix = "https"
        type = "System.Net.HttpRequestCreator"
      />
      <add prefix = "file"
        type = "System.Net.FileWebRequestCreator"
      />
    </webRequestModules>
  </system.net>
</configuration>

请参见

参考

网络设置架构