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.

⚠️ Important: PortMain requires SQL Server LocalDB, which is different from the full SQL Server Express. If you install SQL Server Express without the LocalDB feature, PortMain will not be able to create its database. Follow Step 1 below carefully to ensure LocalDB is installed correctly.
1

Install SQL Server LocalDB

You need SQL Server 2022 LocalDB installed on your computer. There are two ways to get it:

Option B: Via SQL Server Express Installer

If you've already downloaded SQL Server Express, you can add LocalDB from it.

  1. Run the SQL Server Express installer
  2. Choose "Custom" installation (not "Basic")
  3. In the Feature Selection screen, make sure "LocalDB" is checked
  4. 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.

2

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:

Command Prompt C:\> sqllocaldb info

You should see output like:

MSSQLLocalDB

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:

Command Prompt C:\> sqllocaldb create MSSQLLocalDB
C:\> sqllocaldb start MSSQLLocalDB

You should see:

LocalDB instance "MSSQLLocalDB" created with version 16.0.x.x
LocalDB instance "MSSQLLocalDB" started.

To confirm everything is working, run:

Command Prompt C:\> sqllocaldb info MSSQLLocalDB

Look for State: Running in the output. That means LocalDB is ready.

3

Install PortMain

  1. Download the PortMain installer from the home page
  2. Run the downloaded PortMain_x64-setup.exe file
  3. 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
  4. Follow the installer prompts. The default installation location is:
    C:\Users\<YourName>\AppData\Local\PortMain
  5. 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.

4

Launch & First Run

When you launch PortMain for the first time, the application will:

  1. Start the backend server — this runs locally on your machine (port 6001)
  2. Create the database — automatically creates the PortMainDB database in your LocalDB instance
  3. Initialize tables and procedures — sets up all required database schema and stored procedures
  4. 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.

5

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:

C:\> sqllocaldb info MSSQLLocalDB

If the state shows "Stopped", start it:

C:\> sqllocaldb start MSSQLLocalDB

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 stop MSSQLLocalDB
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:

C:\> sqllocaldb start MSSQLLocalDB

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:

C:\> netstat -ano | findstr :6001

If you see a process using port 6001, note the PID (last column) and terminate it:

C:\> taskkill /PID <pid_number> /F

Then restart PortMain.