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.
In the Wizard that pops up 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
You also need to specify the Web server you to use, in this case IIS. You can choose between the .NET Managed handler (recommended) or the ISAPI module. You can also use IIS Express if a full version of IIS is not installed or you don't have admin rights to run it.
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>. Underneath the install folder you'll end up with three sub folders:
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).
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.
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.
Here's what the generated project structure looks like in Explorer:
This new folder structure (as of Web Connection 6.0) is the recommended layout for a new projects as it creates a simple and portable strucuture of folders that allows all paths to be referenced relatively. It facilitates moving an application to a new location and keep all paths intact if relative paths are used providing XCOPY deployment
Unlike in previous versions where projects ran out of the Web Connection folder, the new project layout references Web Connection via SET PATH references. When the project generates a
SetPath.prgfile that adds the Web Connection folders to your current path. If you run your application and framework file errors appear make sure the WebConnection path is set correctly. Specifically you'll want to reference the
This value specifies the Web folder that the application runs under - ie.
http://localhost/<VirtualPath>. The console will create the virtual path in IIS for you.
You can also leave this value blank in which case the application runs under the root Web site. In either case the Web site has to exist - it will not be created (and you have to select in Step 1 of the Wizard).
In either case the console configures this virtual directory or root site by assigning the file system permissions, execution rights and scripts maps in the selected virtual.
Script maps are extensions that map URLs to your Process class. Whatever file extension you specify, is mapped to the
WebProcess class. So if I map
.wp as shown in the figure,
Login.wp all map to the appropriate method on the
WebProcess class. Script maps are the recommended mechanism for routing requests to your code.
Default script maps for .wc, .wcs and .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