Deploying and running a .NET Web Forms project

Deploying and running the project from the PowerBuilder UI

When a .NET Web Forms project is open in the Project painter and no other painters are open, you can select Design>Deploy Project from the Project painter to deploy the project. When all painters are closed, including the Project painter, you can right-click a .NET Web Forms project in the System Tree and select Deploy from its pop-up menu.

The Output window displays the progress of the deployment and provides a list of application functions, events, and properties that are not supported in the Web Forms version of the application. Most of these warnings are benign and do not prevent users from running the application as Web Forms.

If the 2.0 version is the only version of the Microsoft .NET Framework installed on the server, or if you configured the server to use the 2.0 version for all Web sites by default, you can run the application immediately after you deploy it. You can run the application from PowerBuilder by selecting Design>Run Project from the Project painter menu or selecting the Run Project toolbar icon from the Project painter toolbar. The System Tree pop-up menu for the .NET Web Forms project also has a Run Project menu item.

Deploying to a setup file

If you are deploying a .NET project to an MSI file, you must have a file named License.rtf in the PowerBuilder DotNET\bin directory. The PowerBuilder setup program installs a dummy License.rtf file in this directory, but you should modify this file’s contents or replace the file with another file of the same name. The License.rtf file should contain any license information you want to distribute with your application. You can run the .NET application only after the setup file is extracted to an IIS server. The contents of the License.rtf file display in the setup file extraction wizard.

After you create and distribute the MSI file to an IIS server, you must extract the MSI file on the server. By default the extraction directory is set to C:\Program Files\Webform\applicationName, and the extraction wizard creates the C:\Program Files\Webform\applicationName\applicationName and C:\Program Files\Webform\applicationName\applicationName_root virtual directories, where applicationName is the name of your application.

Although you do not need to modify the default extraction directory to run the application, the extraction wizard does let you change the location of the application directories you extract. If you prefer to keep all your applications directly under the server’s virtual root, you could set the extraction directory to server’s Inetpub\wwwroot directory.

Deploying to a production server

You can deploy a Web Forms application to a production server either by:

Production servers must meet the requirements described in “Configuring ASP.NET for a .NET Web project”. You must install all database clients and have access to all data sources on the production machine. For applications that you deploy to a production server, you should add required database driver DLLs to the Win32 dynamic library list on the Library Files tab page of your Web Forms projects. If you are using ODBC to connect to a database, you should add the PBODB110.INI file to the list of resource files on the Resource Files tab page of Web Forms projects.

The production server must have the following DLLs in its system path: atl71.dll, msvcr71.dll, msvcp71.dll, pbshr110.dll, and if your application uses DataWindow objects, pbdwm110.dll. You can also use the Runtime Packager to deploy required PowerBuilder runtime files to the ASP.NET server. After you install the package created by the Runtime Packager, you must restart the server.

For a complete list of required runtime files and for information on the Runtime Packager, see “Deploying Applications and Components” in Application Techniques.

Deploying to a remote server

You can deploy directly to a mapped server only if the server is in the same domain or workgroup as the development computer. In addition, you must add the development machine user’s Windows login ID as a member of the Administrators group on the remote machine hosting the IIS server. Also, you must share the wwwroot directory with the wwwroot$ share name.

If you copy a Web Forms application from a development machine to a production server, you must copy both the applicationName and applicationName_root folders (and their contents) that were created when you deployed the application locally. Direct deployment to a mapped server automatically adds the necessary ASP.NET user permissions to access these directories, but if you copy files to the server, you must add these permissions manually.

NoteAbout the directory file structure For information on the directory file structure of a deployed Web Forms application under the IIS virtual root directory (\inetpub\wwwroot), see “Using the Web Forms File Manager”.

Granting ASP .NET user permissions

If you copy files to a production server, or extract your Web Forms application from an MSI file, you can use Windows Explorer to grant ASP.NET permissions to the application directories. This method is described in “Setting up a SQL Anywhere database connection”. You can also grant ASP.NET permissions from a command line. The commands are different depending on whether your server is running IIS 5, 6, or 7.

Table 2-3: Commands granting permissions to Web Forms directories

IIS version

Commands for granting appropriate user permissions

5

cacls applicationName\temp /t /e /c /g ASPNET:f cacls applicationName_root /t /e /c /g ASPNET:f

6

cacls applicationName\temp /t /e /c /g IIS_WPG:f cacls applicationName_root /t /e /c /g IIS_WPG:f

7

cacls applicationName\temp /t /e /c /g IIS_IUSRS:f cacls applicationName_root /t /e /c /g IIS_IUSRS:f

Event logging on the production server

If you log Web Forms application events to a production server’s event log (by setting the PBTraceTarget global property to “EventLog”), you must have a registry entry key for PBExceptionTrace. If you use an MSI file to deploy an application to a production server, the PBExceptionTrace key is created automatically. If you deploy directly to a mapped production server or if you copy a Web Forms application to a production server, you must import the PBExceptionTrace key or create it manually.

When you deploy to a local machine, PowerBuilder creates the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PBExceptionTrace. You can export this key to a .REG file and import it to the production server’s registry.

For information on the PBTraceTarget global property, see “Global Web configuration properties”.

If your Web Forms application uses any ActiveX DLLs, such as HTML2RTF.DLL or RTF2HTML.DLL, you must also register these files on the production server.

Running the project from a Web browser

When you run the project from PowerBuilder, the Web browser that opens does not include the browser menu and toolbar. This is because PowerBuilder does not append the starting page, default.aspx, to the URL listed in the project. You can see the application in a browser window that includes the browser menu and toolbar by typing the URL in the browser location window or address bar. The URL address is not case-sensitive.

NoteStarting an application with command line parameters If your application requires command line parameters, you can assign values to the PBCommandParm global property before you deploy the application. For information on setting global properties, see “Global Web configuration properties”.

Application users can override the PBCommandParm parameter set at design time by adding it at the end of the application’s URL, preceded by a question mark. Multiple parameters are separated by the ASCII character code for an empty space (%20). For example, the following address, entered on a single line, uses two start-up parameters for the mypbapp Web Forms application deployed to the www.mysite.com Web site:

http://www.mysite.com/mypbapp/default.aspx?PBCommandParm=p1%20p2

If you do not include the starting page, default.aspx, in a URL that you type in a browser address bar, or if you append default.htm as the starting page, IIS still redirects you to the default.aspx page, but the browser menu and toolbar do not display.