Understanding the ports in lauchsettings.json - visual-studio

Background
I have the following launchsettings.json:
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54732",
"sslPort": 44382
}
},
"profiles": {
"NoteKeeperService": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7249;http://localhost:5249",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
This was generated by Visual Studio and I am trying to understand the different ports that it generated. Specifically there are 4 different ports generated by Visual Studio:
The four ports are:
iisSettings->iisExpress->applicationUrl (Line 7)
Port: 54732 - (http)
iiSettings->IssExpress->sslPort (Line 8)
Port: 44382 - (https)
profiles->applicationUrl (Line 17)
Port: 7249 - (https)
Port: 5249 - (http)
There are a pair (http and https) for IIS Express and a pair for the service directly (when it runs inside of Visual Studio, I think...?) I am guessing they all different so you don't get any port conflicts when running in IIS Express and locally.
Question
And what range rules do these ports follow for generation?
Details (ignorable)
I am creating my own template, and I want to make sure I understand the ranges for each port number so I don't put the ports in an invalid range. The dotnet templating system has a generator for ports, but it requires that I supply a range value for the ports. I am unsure what those ranges should be, or if it even matters.

This is actually more of an OS/Infrastructure question than a Visual Studio question, since ports are how the system will manage communications.
Generally speaking ports < 1024 may be "reserved" for use by "well known" programs. e.g. 80 for http, 443 for https, 21 for ftp etc.
The IANA port list may give you a more complete picture
Safe to say for your Visual Studio template any port between 1025 and 65000 should suffice. It should be up to the end user (developer in this case) to determine if the high range port is already in use by another development project.

Related

Failed to launch debug adapter locally when changing ASPNETCORE_ENVIRONMENT

I have a solution with a pretty standard config structure
appsettings.json
appsettings.Development.json
appsettings.Testing.json
appsettings.Production.json
Testing and Production servers have an ASPNETCORE_ENVIRONMENT set to Testing and Production respectively and the everything works, proper config get's chosen, etc.
I wanted to load appsettings.Testing.json in my local Visual Studio so I went to my launchSettings.json and changed ASPNETCORE_ENVIRONMENT to Testing and Studio throws the error on launch.
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:28725",
"sslPort": 44342
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Testing" <- was "Development"
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
}
}
Just to summarize all I did was changed that one setting from Testing to Development and Studio throws the Failed to launch debug adapter error upon launching.
And that's kinda it, nothing in the output windows, nothing in the windows eventviewer that I could find.

how to unreserve ports in windows

I am using SharePoint framework webpart and the default port for workbench is 4321, for another webpart developing the port is reserved and the workbench page is cant reach, I changed the port to 4322 for example, but how we can unreserved the default port?
The port for SPFX WebPart is denified in config->serve.json, you can change to the default port there:
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://localhost:5432/workbench",
"api": {
"port": 5432,
"entryPath": "node_modules/#microsoft/sp-webpart-workbench/lib/api/"
}
}

FTP-Sync for Visual Studio Code with implicit FTP TLS/SSL

I'm trying to mimic my working WinSCP FTP site on Visual Studio Code with the FTP-Sync package and I can't get this done for some reason.
Our server requires implicit FTP so my working site is ftps://ftpwebsite.user:990 and it prompts for my user and pass which works.
This package tries to connect for a minute and then closes with no luck.
Config file:
{
"protocol": "ftps",
"host": "ftpweb.user",
"port": 990,
"user": "ftpweb.user|user123",
"pass": "**********",
"remote": "/",
"secure": false,
"uploadOnSave": true,
"passive": true,
"debug": true,
"privateKeyPath": null,
"passphrase": null,
"agent": null,
"watch":[],
"watchTimeout": 500,
"allow": [],
"ignore": [
"\\.vscode",
"\\.git",
"\\.DS_Store"
],
"generatedFiles": {
"extensionsToInclude": [
""
],
"path": ""
}
}
It seems that the ftp-sync uses Node.js node-ftp module.
And it seems that for it to use implicit TLS/SSL, you need to set secure to implicit:
secure - mixed - Set to true for both control and data connection encryption, 'control' for control connection encryption only, or 'implicit' for implicitly encrypted control connection (this mode is deprecated in modern times, but usually uses port 990) Default: false
See also How to connect to a implicit FTPS server with nodeJS?
Though are you sure that you need to use the implicit mode? As even mentioned in the above documentation, the implicit mode is obsolete.

Setting up site in sublime text ftp manager

I have a perfectly working instance of WinSCP that I"m using for ftp. I have no problems with it but it's inconvenient and I want to use FTP within sublime text
I installed the SFTP/FTP package and trying to setup my remote server but the connection times out every time.
WinSCP details from site manager:
File Protocol: FTP
Encryption: TLS/SSL Implicit Encryption
Host Name: ftp.testUser.testSite
port number: 990
user name: ftp.testUser.testSite|testUser
password: test123!
Current sftp-config.json file:
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "ftp",
"sync_down_on_open": true,
"sync_same_age": true,
"host": "ftp.testUser.testSite",
"user": "ftp.testUser.testSite|testUser",
"password": "test123!",
"port": "990",
"remote_path": "C:/users/testUser/ftpweb/siteFolder",
//"file_permissions": "664",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_timeout": 30,
//"keepalive": 120,
"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"ssh_key_file": "~/.ssh/id_rsa",
//"sftp_flags": ["-F", "/path/to/ssh_config"],
//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
"allow_config_upload": true,
}

Querying remote registry service on machine <IP Address> resulted in exception: Unable to change open service manager

My cluster Config file as follows
`
{
"name": "SampleCluster",
"clusterConfigurationVersion": "1.0.0",
"apiVersion": "01-2017",
"nodes":
[
{
"nodeName": "vm0",
"iPAddress": "here is my VPS ip",
"nodeTypeRef": "NodeType0",
"faultDomain": "fd:/dc1/r0",
"upgradeDomain": "UD0"
},
{
"nodeName": "vm1",
"iPAddress": "here is my another VPS ip",
"nodeTypeRef": "NodeType0",
"faultDomain": "fd:/dc1/r1",
"upgradeDomain": "UD1"
},
{
"nodeName": "vm2",
"iPAddress": "here is my another VPS ip",
"nodeTypeRef": "NodeType0",
"faultDomain": "fd:/dc1/r2",
"upgradeDomain": "UD2"
}
],
"properties": {
"reliabilityLevel": "Bronze",
"diagnosticsStore":
{
"metadata": "Please replace the diagnostics file share with an actual file share accessible from all cluster machines.",
"dataDeletionAgeInDays": "7",
"storeType": "FileShare",
"IsEncrypted": "false",
"connectionstring": "c:\\ProgramData\\SF\\DiagnosticsStore"
},
"nodeTypes": [
{
"name": "NodeType0",
"clientConnectionEndpointPort": "19000",
"clusterConnectionEndpointPort": "19001",
"leaseDriverEndpointPort": "19002",
"serviceConnectionEndpointPort": "19003",
"httpGatewayEndpointPort": "19080",
"reverseProxyEndpointPort": "19081",
"applicationPorts": {
"startPort": "20001",
"endPort": "20031"
},
"isPrimary": true
}
],
"fabricSettings": [
{
"name": "Setup",
"parameters": [
{
"name": "FabricDataRoot",
"value": "C:\\ProgramData\\SF"
},
{
"name": "FabricLogRoot",
"value": "C:\\ProgramData\\SF\\Log"
}
]
}
]
}
}
It is almost identical to standalone service fabric download demo file for untrusted cluster except my VPS ip. I enabled remote registry service.I ran the
\TestConfiguration.ps1 -ClusterConfigFilePath \ClusterConfig.Unsecure.MultiMachine.json but i got the following error.
Unable to change open service manager handle because 5
Unable to query service configuration because System.InvalidOperationException: Unable to change open service manager ha
ndle because 5
at System.Fabric.FabricDeployer.FabricDeployerServiceController.GetServiceStartupType(String machineName, String serv
iceName)
Querying remote registry service on machine <IP Address> resulted in exception: Unable to change open service manager
handle because 5.
Unable to change open service manager handle because 5
Unable to query service configuration because System.InvalidOperationException: Unable to change open service manager ha
ndle because 5
at System.Fabric.FabricDeployer.FabricDeployerServiceController.GetServiceStartupType(String machineName, String serv
iceName)
Querying remote registry service on machine <Another IP Address> resulted in exception: Unable to change open service manager
handle because 5.
Best Practices Analyzer determined environment has an issue. Please see additional BPA log output in DeploymentTraces
LocalAdminPrivilege : True
IsJsonValid : True
IsCabValid :
RequiredPortsOpen : True
RemoteRegistryAvailable : False
FirewallAvailable :
RpcCheckPassed :
NoConflictingInstallations :
FabricInstallable :
DataDrivesAvailable :
Passed : False
Test Config failed with exception: System.InvalidOperationException: Best Practices Analyzer determined environment has
an issue. Please see additional BPA log output in DeploymentTraces folder.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
I don't understand the problem.VPSs are not locally connected. All are public IP.I don't know, this may b an issue. how do I make virtual LAN among these VPS?Can anyone give me some direction about this error?Anyone helps me is greatly appreciated.
Edit: I used VM term insted of VPS.
Finally I make this working. Actually all the nodes are in a network, i thought it wasn't. I enable file sharing. I try to access the shared file from the node where I ran configuration test to the all other nodes. I have to give the credentials of logins. And then it works like a charm.

Resources