Step 1 - Creating a new project
The first step to create a brand new application is by creating a new project for your application. To do so start the West Wind Management Console from the VFP command window:
Click on the Create New Project button to create a new Visual FoxPro project that includes the base Web Connection framework classes and the startup code.
Start by naming the project and the main process class. The project name should be the filename of the project you want to create. Use a single string value without spaces for this setting. In this case I'll create a project named
WebDemo and a process class named
A Process is the actual request handler class, where you will write your logic to handle Web
requests. A single project can contain several Process classes.
WebProcess contains methods for each of the Web operations we want to handle. To make it real obvious which pieces I'm talking about in this demo I'll name the project
WebDemo and the process
Web Connection works with several different Web servers:
- Full IIS (used for production, optionally for dev)
- IIS Express (dev only)
- Web Connection Web Server (dev, optionally for production)
- Apache for Windows (not recommended)
For local development we recommend you use either IIS Express or the Web Connection .NET Core based Web Server both of which require installation. Before you can use any of these servers make sure the server is installed or configured.
IIS has to be installed as a Windows Feature, IIS Express is a seperate installation, and the Web Connection Web Server requires a .NET Core 5 or later. The server links above point at the individual server configuration instructions.
Note you can always switch between Web Servers when running your applications using
launch("<webServerType>"). For IIS Express or the Web Connection Web Server - assuming the pre-requisites are installed - Web Server configurations are completely portable, so they just work.
For IIS however explicit Web Server configuration is required to configure IIS for the Web site. You can run
DO <yourApp>_ServerConfig.prgto configure IIS for the current project assuming it is installed (more info).
Step 2 of the Wizard lets you specify the location of the project and how to reference it from the Web.
You specify the base path for the project, which defaults to
c:\WebConnectionProjects\<YourProjectName>. Web Connection projects are fully self-contained with all installed files contained in this folder structure which contains your code and executable, your Web assets and optionally data all separated into folders.
Underneath the install folder you end up with three sub folders:
Web (html, images, css, js etc.)
This is where all your Web files go: Html, CSS, JS and any Web Connection Templates and Scripts. This folder also holds the Web Connection binary connectors (.NET and ISAPI) and the Web app configuration (web.config).
Deploy (code and executables)
This is your executable folder where you can put your code and executable. Also any configuration files or other data that the application needs at runtime can go here. If your data usage is simple you can also keep local database files here, but if you have a complex data model put it in the Data folder or a subfolder of this folder.
This folder also contains a TEMP folder where the Web Connecion message files are stored for file based messaging.
Data (optional - separate data location)
This folder is optional and meant for data in your application. If you use local data I recommend you use this folder to isolate your data from the application while still using a relative folder path. By keeping data in a separate folder it makes it cleaner to distribute code or data separately.
Here's what the generated project structure looks like in Explorer:
The project layout references Web Connection via
SET PATHreferences. The project generates a
Launch.prgfile that adds the Web Connection folders to your current path. If that folder or your project moves, you may have to adjust these paths.
If you run your application and framework file errors appear, you can change the paths in
Launch.prgof your project to point to the right locations for
This IIS specific, optional value specifies the virtual subfolder an IIS Web runs under. A virtual Web site URL looks like this:
webdemo is the virtual folder below the Web root. You can leave the value blank to specify that you want to use the root Web site on IIS:
Virtual paths on IIS are useful to allow you run multiple 'virtual' Web sites off a single Web site hosted on port 80, without explicitly setting up custom host header domains.
Using virtuals is common for local development, while running with a root Web site in production.
If you opt to use the local IIS Express or Web Connection Web Server instead of IIS, the path to your site will always be a root path like
http://localhost:7000and the virtual path specified is ignored.
Script maps are extensions (like
wp above) that map URLs to the new Process class we are creating. Whatever file extension you specify, is mapped to the
WebProcess class we created in the previous step. So. if I map
wp as shown in the figure,
Login.wp all map to the appropriate method on the
Typically each application you create uses its own custom script that identifies your process class but you can map multiple script maps to specific application using a comma delimited list (ie.
Note that several default script maps for
.wcsx are automatically configured for your application. These script mappings are stored in the
web.config file and you can remove or add additional scriptmaps there later.
When you click the
Finish button on the final page console goes ahead and creates your new project for you. When it's done it'll pop up the project Web page and opens Visual FoxPro ready for you to run your project.
The console performs these steps:
- Creates the Project Folder structure and copies all files
- Creates a virtual directory
- Creates the Scriptsmaps on the Virtual directory
- Creates a Web Connection Application Pool (if it doesn't exist)
- Sets the disk permissions
- Matches both Web Connection Web and Server configuration settings
- Creates a FoxPro Project of your project (not supported in the shareware version)
Comment or report problem with topic