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

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

<system.net> 
</system.net>

特性和元素

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

特性

无。

子元素

元素

说明

<authenticationModules>

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

connectionManagement

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

<defaultProxy>

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

<mailSettings>

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

<requestCaching>

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

<设置>

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>

请参见

参考

网络设置架构