Adds exception handling for the port binding.