How to: Modify the Computer Configuration File to Enable IPv6 Support
The following code example shows how to modify the computer configuration file, machine.config, to enable IPv6 support. The machine.config file is stored in the %Windir%\Microsoft.NET\Framework folder in the directory where Windows was installed. There is a separate machine.config file in the folders under %Windir%\Microsoft.NET\Framework for each version of the .NET Framework installed on the computer (for example, C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\machine.config).
These settings can also be made in the configuration file for the application, which has precedence over the computer configuration file.
For .NET Framework version 1.1 and earlier, the value of the ipv6 enabled configuration switch specifies whether members of the System.Net.Dns class return IPv6 addresses.
For .NET Framework version 2.0 and later, if Windows supports IPv6, then all members of the System.Net.Dns class (for example, the Dns.GetHostEntry method), will return IPv6 addresses with one limitation. Obsolete members of the System.Net.Dns class (for example, the Dns.Resolve method) will read and recognize the value in the configuration file.
注意事項 |
---|
For .NET Framework version 2.0 and later, IPv6 is enabled by default. For .NET Framework version 1.1 and earlier, IPv6 is disabled by default. |
範例
<system.net>
…………
<settings>
…………
<ipv6 enabled="true"/>
……………
</settings>
………………
<system.net>