You could add this in your app.config.
<appSettings>
<add key="Port" value="8000" />
</appSettings>
And read it out in the code
string port = ConfigurationManager.AppSettings["Port"];
After you read the port in you have to create the url.