Installation & Setup Guide
Follow these steps to get PortMain up and running on your computer. The entire process takes about 10–15 minutes.
Before You Begin
PortMain uses Microsoft SQL Server LocalDB to store your portfolio data locally on your computer. LocalDB is a lightweight, free version of SQL Server that runs on demand — it requires no configuration and no background services.
In This Guide
Install SQL Server LocalDB
You need SQL Server 2022 LocalDB installed on your computer. There are two ways to get it:
Option A: Standalone LocalDB Installer
The quickest way — downloads and installs only LocalDB (under 50 MB).
- Go to the SQL Server Downloads page
- Scroll down and click "Download now" under Express
- Run the downloaded installer
- Choose "Download Media"
- Select "LocalDB" and pick a download location
- Run the downloaded SqlLocalDB.msi file
- Follow the prompts to complete installation
Option B: Via SQL Server Express Installer
If you've already downloaded SQL Server Express, you can add LocalDB from it.
- Run the SQL Server Express installer
- Choose "Custom" installation (not "Basic")
- In the Feature Selection screen, make sure "LocalDB" is checked
- Complete the installation
Common mistake: If you chose the "Basic" installation option in the SQL Server Express installer, LocalDB may not be included. You must choose "Custom" and explicitly select the LocalDB feature, or use Option A above to install it separately.
Verify LocalDB Installation
After installing, verify that LocalDB is working correctly. Open a Command Prompt or PowerShell window
(press Win + R, type cmd, press Enter) and run:
You should see output like:
If you see MSSQLLocalDB listed, LocalDB is installed correctly.
If the command is not recognized, LocalDB is not installed — go back to Step 1.
First-time setup: If this is a fresh installation, you may need to create and start the LocalDB instance. Run these commands:
C:\> sqllocaldb start MSSQLLocalDB
You should see:
LocalDB instance "MSSQLLocalDB" started.
To confirm everything is working, run:
Look for State: Running in the output. That means LocalDB is ready.
Install PortMain
- Download the PortMain installer from the home page
-
Run the downloaded
PortMain_x64-setup.exefile - If Windows SmartScreen shows a warning, click "More info" then "Run anyway" — PortMain is a self-published application and may not have a code-signing certificate
-
Follow the installer prompts. The default installation location is:
C:\Users\<YourName>\AppData\Local\PortMain - The installer will set up both the backend server and the frontend application automatically
The installation is about 60 MB and includes everything needed except SQL Server LocalDB, which must be installed separately as described in Step 1.
Launch & First Run
When you launch PortMain for the first time, the application will:
- Start the backend server — this runs locally on your machine (port 6001)
- Create the database — automatically creates the
PortMainDBdatabase in your LocalDB instance - Initialize tables and procedures — sets up all required database schema and stored procedures
- Open the application window — you'll see the login screen once initialization completes
Please be patient on first launch. Database initialization may take 30–60 seconds. The application window may appear blank briefly while the backend completes setup. Subsequent launches will be much faster.
You're all set! Once you see the PortMain login screen, your installation is complete. Create your first user account and start managing your portfolio.
Troubleshooting
If PortMain doesn't start correctly, check these common issues:
App shows a blank screen or connection error
This usually means the backend couldn't connect to LocalDB. Verify LocalDB is installed and the instance is running:
If the state shows "Stopped", start it:
Then restart PortMain.
"sqllocaldb" is not recognized as a command
This means SQL Server LocalDB is not installed. Go back to Step 1 and install it using Option A (standalone installer). After installation, you may need to close and reopen your Command Prompt.
I installed SQL Server Express but PortMain still doesn't work
SQL Server Express and SQL Server LocalDB are different components. PortMain specifically requires LocalDB.
If you installed Express using the "Basic" option, LocalDB may not have been included. You can install LocalDB separately using the standalone SqlLocalDB.msi installer (see Step 1, Option A).
Having SQL Server Express installed alongside LocalDB will not cause any conflicts.
Error creating database or "cannot attach" errors
This can happen if the LocalDB instance is in a corrupted state. Try recreating it:
C:\> sqllocaldb delete MSSQLLocalDB
C:\> sqllocaldb create MSSQLLocalDB
C:\> sqllocaldb start MSSQLLocalDB
Then restart PortMain. The application will recreate the database automatically.
Note: Deleting the LocalDB instance will remove any previously created databases. If you have existing portfolio data, make sure to export or back it up first.
Windows SmartScreen blocks the installer
Since PortMain is an independently published application, Windows may show a SmartScreen warning. This is normal for software without a commercial code-signing certificate.
To proceed: click "More info" on the SmartScreen dialog, then click "Run anyway".
PortMain was working but stopped after a Windows update
Windows updates can occasionally reset or update the LocalDB instance. Try:
If that doesn't work, recreate the instance (see "Error creating database" above).
How to check backend logs for errors
The backend writes log files that can help diagnose issues. Check these locations:
%LOCALAPPDATA%\PortMain\logs\backend.log— backend server log%LOCALAPPDATA%\PortMain\portmain.log— application startup log
To open the logs folder, press Win + R, type %LOCALAPPDATA%\PortMain, and press Enter.
Look for error messages related to "SqlClient", "LocalDB", or "connection" — these indicate database connectivity issues.
Port 6001 is already in use
If another application is using port 6001, or if a previous PortMain instance didn't shut down cleanly, you may see this error.
Open a Command Prompt as Administrator and run:
If you see a process using port 6001, note the PID (last column) and terminate it:
Then restart PortMain.