Starcounter
HomeDownloadDocsCommunity
2.3.1
2.3.1
  • Starcounter Documentation
  • Getting Started
  • Starcounter
    • Collapsing the Stack
      • Complexity and Scalability Tradeoff
      • The Future of Micro-Services
      • 10 Benefits of Collapsing the Stack
    • Integrated Database and Web Server
  • Hello World - Tutorial
    • Create a Database Class
    • Create a Real Time UI
    • First Interactive UI
    • Computed Properties
    • Expense Tracker
    • Cancel and Delete
    • The Next Step
  • Guides
    • Database
      • Database Classes
      • Data manipulation
      • Object Identity and Object References
      • Querying with SQL
      • Data Types
      • Relations
      • Inheritance
      • Sharing data
      • Database Configuration
      • Comparing Database Objects
      • Referential Integrity and Constraints
    • SQL
      • Identifiers
      • Path Expressions
      • Data operators
      • Joins
      • Aggregates
      • Comparisons and Logical Operators
      • Sorting
      • Fetch
      • Offset Key
      • Indexes
      • Literals
      • Query Plan Hints
      • Reserved words
      • Query for Database Classes
      • SQL Isolation Between Applications
    • Transactions
      • Short-Running Transactions
      • Long running transactions
      • Using Transactions
      • Running Background Jobs
      • Commit Hooks
    • Typed JSON
      • JSON-by-example
      • Code-Behind
      • Data Bindings
      • Callback Methods
      • Responding with JSON
      • Accepting JSON in Requests
      • Primitive Arrays and Single Value Types
      • Typed JSON Internals
    • Blendable Web Apps
      • Starcounter MVVM
      • Palindrom
      • Client-Side Stack
      • Sessions
      • HTML Views
      • App Shell
      • Web Components
      • View Attaching
      • View Composing
      • HTML Compositions
      • HTML Views Blending Guidelines
      • Avoiding CSS conflicts
      • Debugging
    • Network
      • HTTP
      • Internal Self Calls
      • Middleware
      • Anonymous or Substitute Handlers
      • URL Aliases and Redirects
      • Network Gateway
      • Static File Server
      • External HTTP Calls
      • WebSocket
      • Avoiding URI conflicts
      • TCP Sockets
      • UDP Sockets
    • Publishing Apps
    • Working with Starcounter
      • Release Channels
      • Starting and Stopping Apps
      • Administrator Web UI
      • Star CLI
      • StarAdmin CLI
      • StarDump CLI
      • Working in Visual Studio
      • Error Log
      • Using HTTPS on NGINX
      • Using HTTPS on IIS
      • Run Starcounter in Production
      • Weaver
      • Investigating App Crashes
      • Configuration Structure
      • Database Refactoring
      • Using Unload/Reload to Modify Database Schema
      • Kernel Questions and Answers
      • Log Files
  • Cookbook
    • Attach an HTTP Request to an Existing Long-Running Transaction
    • Cookie-Based Authentication
    • Timestamp on Object Creation
    • Creating Strongly Typed JSON Collections
    • Migrating From 2.2 to 2.3+
    • Multiple Pages
    • Icons
    • Proposed Project Structure
    • Acceptance Testing with Selenium
    • Requesting a User to Authenticate
    • How to delete unused tables and columns
Powered by GitBook
On this page
  • Introduction
  • Starting
  • Command Line
  • Administrator Web Interface
  • Visual Studio
  • Stopping
  • Command Line
  • Administrator Web Interface
  • Visual Studio
  • Running Multiple Apps
  • Reading the Console Output
  1. Guides
  2. Working with Starcounter

Starting and Stopping Apps

Introduction

Starcounter apps can be started and stopped with the star CLI, the Administrator, and Visual Studio. This page describes how to use these tools to start and stop apps.

Starting

Starcounter applications are compiled into .exe files. These applications are then run inside Starcounter.

Applications in Starcounter are always run in the context of a single database. This means that accessing information in that database is lightning fast. It does not mean that the application is not allowed to access other databases (more on node-to-node communication later).

Command Line

To start an app from the command line, you use the star command. It accepts .cs files in addition to .exe files.

C:\> star hello.exe
[Starting "hello.exe" in "Default" on "Personal" (127.0.0.1:8181)]
"hello.exe" started in database "Default". Default port is 8080 (Executable),
8181 (Admin))

C:\> star test.cs
[Starting "test.cs" in "Default" on "Personal" (127.0.0.1:8181)]
"test.cs" started in database "Default". Default port is 8080 (Executable),
8181 (Admin))

The command line option --database (or -d) can be used to specify what database to run the application in.

C:\> star --database=mydb hello.cs
[Starting "hello.cs" in "mydb" on "Personal" (127.0.0.1:8181)]
"hello.cs" started in database "mydb". Default port is 8080 (Executable),
8181 (Admin))

Administrator Web Interface

Visual Studio

In Visual Studio, press F5 to start the application. The Starcounter personal server will load the executable and execute it in the Default database context. If the personal server is not running it will be started automatically.

Specifying Options in Visual Studio

In fact, Visual Studio plugin supports most of the star.exe command line arguments. You can specify particular arguments by altering Project | Properties | Debug | Command line arguments. By default, the application is started in a database default. To start the application in any other database, such as foo, add this to Command line arguments: -d=foo.

Stopping

Contrary to desktop programs, the program remains loaded after main has been executed. You can unload all code without stopping the database. The database memory lives in a separate process and the database memory is shared between you program code and the database process.

Command Line

In order to unload a program, you need to run the star --stop <application> command.

C:\> star --stop hello.cs
[Stopping "hello.cs" in "Default" on "Personal" (127.0.0.1:8181)]
  - Restarting database "Default"
Stopped "hello.cs" in database "Default"

Administrator Web Interface

Visual Studio

You cannot stop an app from Visual Studio.

Running Multiple Apps

When you run multiple apps in the same database, as with hello.exe and test.cs in the example below, they are all loaded into the same database process. The code you load keeps adding to the code being loaded into the database.

Starting apps for the first time, even if you have other apps loaded, is fast. The reason for this is that there is no need to recycle the host process. On the other hand, if you want to restart an application, there is one thing that you have to keep in mind: restarting an app requires the host process to be recycled. The consequence of this is that all other apps that are running need to be stopped, unloaded, and started again. Due to this, it takes significantly more time to restart an application when there are other apps running than when you start an application.

For example, if you have three apps up and running and you would like to start another app, let's name it app4.exe. Then you would simply run star app4.exe which would start the app without much delay. Now, if you want to restart two of the other apps, app1.exe and app2.exe the situation would be different. Simply running star app1.exe would require the host process to be recycled, app2.exe, app3.exe, and app4.exe to be stopped, unloaded, and started again. The same would be the case when we restart app2.exe. This code describes the gist of the process:

host = [app1, app2, app3, app4]

def star(my_app):
  if my_app in host:
    new_host = []
    for app in host:
      stop(app)
      unload(app)
      start(app)
      new_host.append(app)
    return new_host

  #starts app and adds it to the already running host process
  else:
    start(my_app)
    return host

host = star(app2)

To handle this in cases where you would like to restart a set of applications you can run staradmin stop host and then start the applications one at a time. This allows us to circumvent the inefficient for loop and start the application directly. If you have to restart several applications, this is the preferred approach.

In other cases, where you just want to start an application from scratch or restart one or two applications in a small set of apps, you should simply start, or restart the desired application by running star myapp.exe. Starcounter will, in this case, make sure that the state of your applications is maintained and that all applications that were running previously are restarted. This may take some more time, as explained above.

All running Starcounter applications must have a unique name. You cannot run two instances of the same application in a single database.

Reading the Console Output

The console output does not go to the standard output (i.e. console). After all, your program is likely to run in the cloud or on your local personal server. Instead, any standard output is directed to a server side memory buffer. The Administrator web user interface can monitor the output. If there is no Administrator web session listening to the output, the output is discarded.

To see the console output in Administrator, navigate to the database by clicking on its name (e.g., default) in the list of databases or navigate to the application by clicking on the application name in the list of applications.

PreviousRelease ChannelsNextAdministrator Web UI

Last updated 7 years ago

In the default Starcounter configuration, the Administrator web interface is available at .

Go to . Select a database from the "Databases" menu (e.g. default) or create a new database, then click on "Start Executable". Provide path to the .exe or select it from the disk and press "Start".

In the default Starcounter configuration, the Administrator web interface is available at .

Go to . Select a database from the "Databases" menu (e.g. default). You will see a list of apps running in the selected database. You can use the "Stop" button to unload each of the apps.

In the default Starcounter configuration, the Administrator web interface is available at .

http://localhost:8181/
http://localhost:8181/
http://localhost:8181/
http://localhost:8181/
http://localhost:8181/