共用方式為


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 DNS methods, for example, GetHostEntry, will return IPv6 addresses with one limitation: obsolete DNS methods, for example, Resolve, will read and recognize the value in the configuration file.

NoteNote

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.

Example

<system.net>
    …………
    <settings>
        …………
        <ipv6 enabled="true"/> 
    ……………
    </settings>
    ………………
<system.net>

See Also

Concepts

IPv6 Addressing