Firewall Instructions
You must enable several ports or programs in the firewall so that the Windows Communication Foundation (WCF) samples can function. Many of the samples communicate by using ports in the range 8000-8003, and port 9000. The firewall is turned on by default and prevents access to these ports. To enable the firewall for the samples, complete one of the following procedures, depending on your requirements and security environment:
Option 1: Interactively enable samples while running. Make no advance changes to your firewall configuration and proceed to start building and running the samples. When a sample is run, a Windows Security Alert dialog box appears. The sample program in question can then be added interactively to an unblocked list. With this procedure, you may have to then restart the sample.
Option 2: Enable sample programs in advance. Start the Windows Firewall Control Panel applet and enable the sample programs you plan to run. You must build the programs first so the executable files exist. You can find more detailed instructions in the following procedure.
Option 3: Enable a port range in advance. Start the Windows Firewall Control Panel applet and enable ports 80, 443, 8000-8003 and 9000, which are used by the samples. You can find more detailed instructions in the following procedure. This option is less secure than the others because it allows any program to use these ports, not just the samples.
If you are unsure of which procedure to use, choose the first option. If you are running a firewall from another vendor, you might need to make similar changes.
Note: |
---|
Changing your firewall configuration affects your security. It is recommended that you record the changes you make and remove them when you are finished working with the samples. |
To enable samples programs in advance
Build the sample.
Click Start, click Run, and type firewall.cpl. This opens the Windows Firewall Control Panel applet.
Note
You must have permission to change the Firewall settings to run samples that require the ability to communicate through the Windows Firewall. If some firewall settings are unavailable and your computer is connected to a domain, your system administrator might be controlling these settings through Group Policy.
Complete one of the following operating specific steps to allow a program through the Windows Firewall:
On Windows 7 or Windows Server 2008 r2, click Allow a program or feature through Windows Firewall. Click Change Settings, Allow Another Program….
On Windows Vista or Windows Server 2008, click Allow a program through Windows Firewall.
On the Exceptions tab, click Add Program.
Click the Browse button and select the executable file of the sample you plan to run.
Repeat steps 4 and 5 until you have added the executable files of all the samples you plan to run.
Click OK to close the firewall applet.
To enable a port range in advance
Click Start, click Run, and type firewall.cpl. This opens the Windows Firewall Control Panel applet.
On Windows 7 or Windows Server 2008 R2, follow these steps.
Click Advanced settings in the left column of the Windows Firewall window.
Click Inbound Rules in the left column.
Click New Rules in the right column.
Select Port and click next.
Select TCP and enter 8000, 8001, 8002, 8003, 9000, 80, 443 in the Specific local ports field.
Click Next.
Select Allow the connection, and click Next .
Select Domain and Private, and click Next.
Name this rule WCF-WF 4.0 Samples, and click Finish.
Click Outbound Rules and repeat steps c to h.
On Windows Vista or Windows Server 2008, follow these steps.
Click Allow a program through Windows Firewall.
On the Exceptions tab, click Add Port.
Enter a name, enter 8000 as the port number, and select the TCP option.
Click the Change Scope button, select the My Network (subnet) only option, and click OK.
Repeat steps b to d for ports 8001, 8002, 8003, 9000, 80, and 443.
Click OK to close the firewall applet.
Note
Remove any firewall exceptions when you are finished working with the samples. To do so, open the Windows Firewall Control Panel applet and remove any programs or port entries that were added by the previous procedures.