Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Creating installers incorporating UWS as a redistributable component
Ultidev Team
#1 Posted : Saturday, June 18, 2011 2:26:56 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,063

Thanks: 28 times
Was thanked: 35 time(s) in 34 post(s)
Following articles assume reader's familiarity with registration of redistributable applications best practices.

Important note for redistributable web app installation authors:

  • UWS depends on .NET Framework 2.0 (3.x will do too) in order to run. Be sure to add .NET 2.0 dependency to your installer package, as UWS redistributable installer, being an MSI package, does not carry information regarding its dependencies.
  • If your application targets ASP.NET 4.x, please be sure to add ".NET Framework 4.0 Full" as a dependency. Many desktop systems have .NET Framework 4.0 Client Profile, which is insufficient for running ASP.NET 4.x web apps.


Examples referenced below focus on using UWS command line utility to register and unregister applications. For information about registering web apps with UWS using COM/VB/VBA/VBS APIs, please refer to this post.


Attached ZIP file contains Visual Studio 2010 solution with a simple ASP.NET application and three Installation projects: VS Setup & Deployment project, InstallShield LE (ISLE) project, and an Advanced Installer (AI) project. Even if AI and ISLE project don't get loaded, you can still build the solution and test Visual Studio installer.
File Attachment(s):
UWS ASP.NET App Redistribution Example.zip (1,285kb) downloaded 304 time(s).
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
2 users thanked Ultidev Team for this useful post.
FSBarker on 10/13/2011(UTC), bagosm on 1/20/2012(UTC)
Ultidev Team
#2 Posted : Saturday, June 18, 2011 2:31:18 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,063

Thanks: 28 times
Was thanked: 35 time(s) in 34 post(s)
Please be sure to get familiar with registration of redistributable applications.

UWS.RegApp.exe - an application registration utility - has following command line switches:

Code:
UWS.RegApp.exe allows registering and unregistering web sites and applications with UltiDev Web Server Pro.

Examples:

To register local web application or site there are only three required parameters - register command, application ID, and path to folder with site files:
UWS.RegApp.exe -register appid={BFEA5241-1EAF-47C2-9E5B-ADE7AC9CE080} "/Folder:c:\ProgramData\Company\Web App"

There are lots of other parameters that can be used during application registration (see list below). For example:
UWS.RegApp.exe /r /AppID:{BFEA5241-1EAF-47C2-9E5B-ADE7AC9CE080} /Clr:2 /VDir:/somevdir /autostart "/EndPoints:http://*:0/" "/Folder:c:\ProgramData\Company\Web App" "/AppName:My Superapp" /host:SharedNetworkService "/AppDesc:Some useful application description"

To unregister site or application one needs to provide only two arguments - unregister command and application ID:
UWS.RegApp.exe /unreg /AppID:{BFEA5241-1EAF-47C2-9E5B-ADE7AC9CE080}
UWS.RegApp.exe u /appid={BFEA5241-1EAF-47C2-9E5B-ADE7AC9CE080}

All registration/unregistration ERRORS are logged in Windows Event Log (Application).

Command line parameters are not case-sensitive, may start with '/' or '-', but it's not a requirement. Most parameter names have synonyms to simplify usage so you could just guess parameter names (see below). Parameter values are separated from parameter names by either ':' or '=' characters. Don't forget to enclose parameters with whitespaces into double qoutes, like "/dir:c:\Program Data\Whatever Else".

Boolean parameter values can be as follows: 'true' or 'false', 'yes' or 'no', 'on' or 'off', 'allow', 'deny' or 'prohibit', 'start' or 'stop'. If boolean value is omitted, it defaults to True. For example, "/compress" is equivalent to "/compress:yes".


Parameter information:


PHYSICALDIRECTORY, type: String.
Recognized parameter name variations: "path", "appfolder", "folder", "applocation".
Description: File system or network path to the folder containing application or site files. It's a required parameter when registering an application, or launching it in interactive server.

VDIR, type: String.
Recognized parameter name variations: "virtualdirectory", "vpath".
Description: Vritual directory. Default value is '/'.

DEFAULTDOCUMENT, type: String.
Recognized parameter name variations: "ddoc", "defaultdoc", "appdefaultdoc".
Description: Default document to be server when request URL ends with folder name. If not specified, server will look for a document named Index or Default having an extension like Html, Aspx or other web application file extensions. If no such file is found, and directory browsing is enabled, directory document list will be returned.

REALM, type: String.
Recognized parameter name variations: "domain".
Description: Realm for Basic or Digest authentication.

COMPRESSION, type: Boolean.
Recognized parameter name variations: "compress".
Description: Set to true (default when registering an application) to allow response GZIP compression, provided that request is sent by a client supporting compression. Not all MIME types will be compressed, but HTML, text, XML, JavaScript, CSS and many other types will be compressed.

DIRECTORYBROWSING, type: Boolean.
Recognized parameter name variations: "dirbrowsing", "folderbrowsing".
Description: Set to true (default is false) to make server return list of files when requested URL ends with a folder name and folder does not contain any default documents.

BYPASSAPPSERVERFORSTATICCONTENT, type: Boolean.
Recognized parameter name variations: "bypass".
Description: If set to true (default), requests for static content, like images, CSS, JavaScript, and HTML files, will be served by the web server itself, without giving application a chance to handle the request. Application files, like ASPX, SVC and AXD, are still served by the application. True value is similar to how IIS is confgured by default, and is in contrast to how old UltiDev Cassini and Visual Studio Development Web Server are set up.

IMPERSONATEWINDOWSUSERFORSTATICCONTENT, type: Boolean.
Recognized parameter name variations: "impersonate".
Description: If set to true and selected user authentication schema required Windows authenticaiton, web server will use client user's access rights when serving static content files. This can be used to limit which users have access to static content files. When set to false, host process's user security context will be used to access static files to be served.

ANONYMOUSAUTHENTICATION, type: Boolean.
Recognized parameter name variations: "authanonymous", "anonymous", "anonymousauth".
Description: If set to true (default), web server will not require Windows authentication of users in order togive them access to the application. An application can still use forms/cookie-based authentication to implement custom authorization logic to access different part of the application. When set to False, at least one other authentication schema must be chosen.

BASICAUTHENTICATION, type: Boolean.
Recognized parameter name variations: "authbasic", "basic", "basicauth".
Description: If set to true (default value is false) and Anonymous schema is not selected, browser will require user to supply username and password. Web server does not use supplied username and password on its own and application logic would have to make final authorization decision - unless Basic Auth Against Windows setting is also set to true, in which case web server will allow access to the application if client user could be successfully authenticated against Windows.

BASICAUTHENTICATIONAGAINSTWINDOWS, type: Boolean.
Recognized parameter name variations: "authbasicwindows", "basicwindows", "basicwindowsauth", "basicauthagainstwindows".
Description: If set to true (default is false) and Basic authentication schema is selected, web server will authenticate client user against Windows before granting access to the application.

DIGESTAUTHENTICATION, type: Boolean.
Recognized parameter name variations: "authdigest", "digest", "digestauth".
Description: If set to true (default is false) and Anonymous schema is not selected, web server will authenticate client user against Active Domain (but not local Windows user credential store). When Digest authentication is employed, browsers and other clients will send user password as a hash, not as an actual text. HTTP.SYS driver deems this situation impossible for the web server or an application to handle, and requires that user credential store could to provide access to hashed password, which AD probably does. But still, HTTP.SYS handles Digest authentication completely on its own, always against an AD, and never delegates to the web server.

WINDOWSNEGOTIATEAUTH, type: Boolean.
Recognized parameter name variations: "authnegotiate", "negotiate", "authwinsnegotiate", "authwindowsnegotiate", "negotiateauth", "winnegotiateauth".
Description: If set to true (default is false) and Anonymous schema is not selected, client will be required to authenticate against Windows using Kerberos. Authentication will fall back on NTLM if client does not support Kerberos.

WINDOWSNTLMAUTH, type: Boolean.
Recognized parameter name variations: "authntlm", "ntlm", "authwinsntlm", "authwindowsntlm", "ntlmauth", "winntlmauth".
Description: If set to true (default is false) and Anonymous schema is not selected, client will be required to authenticate against Windows using NTLM.

DYNAMICEXTENSIONS, type: String.
Recognized parameter name variations: "dynamic", "dynext", "dynamicexts", "dynamicext".
Description: A comma-separated list of additional dynamic file extensions (without leading dots) that are to handled by the application server, as opposed to be served as static content. All files with non-dynamic extensions as served as static files. Default extensions, like ASPX, do not need to be added.

REGISTER, type: COMMAND, no value necessary.
Recognized parameter name variations: "reg", "r".
Description: A command to register an application. This parameter ignores any value specified for it.

UNREGISTER, type: COMMAND, no value necessary.
Recognized parameter name variations: "unreg", "u".
Description: A command to unregister an application. This parameter ignores any value specified for it.

APPLICATIONID, type: Guid.
Recognized parameter name variations: "appid", "appguid", "aid".
Description: Application GUID. When upgrading and application, please use the same Application ID. If application with provided ID alreaady exist, it will be replaced with new settings.

LISTENENDPOINTS, type: String.
Recognized parameter name variations: "listenendpoint", "listento", "listenat", "urls", "endpoints", "url", "endpoint", "listenaddresses", "listenaddress".
Description: Optional comma-delimited list of network endpoints that will be used by the web server to serve the application. If not specified, multiple ports will be used, including 80, 8080, and a system-assigned free port. If specified, each endpoint should be in the 'http://address:port' format, where address is a host name, an IP address (IPv4 or IPv6), or '*' or '+' character; and port is either 0 or a valid TCP port number. For example, "/url=http://*:80/,http://*:0/". When port is set to 0, web server will find a free TCP port and assign it to the endpoint. '*' and '+' both mean "any address or host", with the difference that '+' will catch all requests to the endpoint, and '*' will allow nested applications to handle all requests not handled by the application being registered.
Be cautious with using only ports 80 and 443. On Windows XP, IIS 5 (when IIS is manually installed) holds on to these ports in exclusive manner leaving these ports unavailable to other web server. IIS 6 and later share ports just like UltiDev Web Server does, but IIS5 and other web servers may not let your application use port 80. To mitigate this situation, it's highly recommended to use port 0 (system-assigned free prot) in addition to any hard-coded ports.

APPLICATIONNAME, type: String.
Recognized parameter name variations: "appname", "application", "name".
Description: Optional name for the application. This name will be displayed in the Web Application Explorer.

APPLICATIONDESCRIPTION, type: String.
Recognized parameter name variations: "description", "desc", "appdesc", "appdescription".
Description: Optional application description. Description is shown in the Web Application Explorer.

RELATIVEPINGPATH, type: String.
Recognized parameter name variations: "pingpath", "keepalivepath", "keepalivepingpath", "ping".
Description: Optional path to a document relative to the web site root, used by the web server to periodically call the application and ensure it's compiled and loaded into memory, thus drastically improving First Page Served time of low-traffic sites and applications, at the expense of using more memory.

INTEGRATEDWINDOWSAUTH, type: Boolean.
Recognized parameter name variations: "integratedauth", "integrated", "windowsauth", "windowsauthentication", "integratedauthentication".
Description: Combines Windows Negotiate and Windows NTLM authentication settings.

ASPNETVERSION, type: Int32.
Recognized parameter name variations: "clr", "clrversion", "aspnet".
Acceptable values: 1, 2, 3, 4
Description: Version of ASP.NET loaded used by the host process. Default value is 2 (same as 3 because values 2 and 3 can be used interchangibly as they represent same undelying version of CLR). Values 1, 2 and 3 load CLR 2 host process, and 4 uses CLR 4 host process. Setting value to 1 also causes system to ignore value of force32biton64 parameter and set force32biton64 to true.

FORCE32BITON64, type: Boolean.
Recognized parameter name variations: "force32", "force32bit", "32".
Description: If set to true (default is false), on 64-bit systems the application will be hosted in a 32-bit process. It's useful when the application loads native 32-bit components like MS Jet COM client. This setting is ignored on x86 systems.

APPHOST, type: String.
Recognized parameter name variations: "apppool", "pool", "host".
Acceptable values: SharedNetworkService, SharedLocalSystem, PrivateNetworkService, PrivateLocalSystem
Description: Specifies user security context and private-or-shared type of the process hosting the applications.
Network Service user context is more restricted and is better suited for Internet-facing sites and applications. Local System user is more relaxed and makes it easier to program applications because it is close to have your web application running as Administrator. Local System, however, should not be used when hosting Internet-facing application and in other situations where hacking threats are high. Legacy UltiDev Cassini runs as Local System, while IIS in its default configuration uses Network Service or other sufficionly locked-down user accounts.
Private host process will host only the application being registered, while shared processes will host multiple other applications with the same host requirements (CLR, user context and bitness). Private hosts will ensure that stability of your application is not affected by other applications, but each instance of the host process carries a price of increased memory usage from about 10 to 40 MB per process.

ALLOWSAVINGTOUNREGAPPS, type: Boolean.
Recognized parameter name variations: "saveunregapps", "savetounregapps".
Description: If set to true (default), some application settings, like endpoint addresses and ports, will be saved and reused when application is unregistered. These saved settings will be used when the application is registered again. This ensures that when a web application gets upgraded, it will occupy the same port, if during registration process it tells the system to find free TCP port. If set to false, then registration will ignore settings of saved uninstalled settings of the application with the same ID.

CREATESHORTCUT, type: Boolean.
Recognized parameter name variations: "createsc", "createshortcuts".
Description: If set to true (default), a shortcut to the application will be created even if no "shortcutXXX" parameters are specified. Please set to False to avoid creation of a desktop shortcut automatically created with the application name. If set to false, all "shortcutXXX" parameters will be ignored and not application shortcuts will be created. All shortcuts will be removed when application is unregistered.

AUTOSTART, type: String.
Recognized parameter name variations: "start", "run", "browse", "browseto", "navigateto", "launch".
Description: Optional command to launch the application. Optional value may contain two, pipe-separated (|) parts: timeout (milliseconds), and application root-relative path & query string of the launched page. If timeout is not specified, default timeout is 1 minute (60000 milliseconds). Negative timeout means wait until application comes online. Zero timeout means check only once for whether application is online. If path & query string is not specified, default page is used. Application will be launched in a browser if only it is online (or comes online within timeout limits). If timeout is up before application is online, nothing will happen - application won't be launched and registration will end successfully. Examples: "/autostart:45000" will start default app page if the app is online or comes online within 45 seconds; "/autostart" will launch the app in the browser if app comes online within 1 minute; "/autostart:30000|welcome.htm" will launch application's "welcome.htm" page in the browser if app comes online within 30 seconds.

SHORTCUT1LOCATION, type: String.
Recognized parameter name variations: "shortcut1", "shortcut1path", "sc1path".
Description: Specifies name and/or location of an application shortcut file. If specified, the value must be of one of the following three types: 1) a file name with .url extension - that will be placed in the shared desktop folder; 2) a full path to a .url file to be created in an existing folder, and 3) path to an existing folder where the file matching application name plus .url extension will be created. If value is not specified, path to shared desktop folder is used.

SHORTCUT1HOST, type: String.
Recognized parameter name variations: "shortcut1hostname", "sc1host".
Description: A host or IP address to be used in the application URL. If not specified, default hostname will be used. Default host name is machine's fully-qualified domain name (FQDN) if computer is a member of a domain, or machine name if computer is a member of a workgroup. Special name "*IOS*" can be specified to create iPhone/iPad-friendly link in the "machinename.local" format, if computer is a member of a workgroup, or just the machine name if computer is a member of a domain.

SHORTCUT1PATHNAMEANDQUERYSTRING, type: String.
Recognized parameter name variations: "shortcut1pnqs", "sc1pnqs".
Description: An optional site-relative path to an application start page and/or query string.

SHORTCUT1ICONFILE, type: String.
Recognized parameter name variations: "shortcut1iconpath", "shortcut1icon", "sc1icon".
Description: An optional path to a file containing an icon for the application shortcut. Can be a path to an .ICO, or an executable file like .EXE or .DLL. If not specified, a path to "UWS.Explorer.exe" is used.

SHORTCUT1ICONINDEX, type: UInt16.
Recognized parameter name variations: "sc1iconindex", "sc1iindex".
Description: An optional icon index in the icon file specified by "shortcuticonfile" parameter. Default value is 0.

SHORTCUT2LOCATION, type: String.
Recognized parameter name variations: "shortcut2", "shortcut2path", "sc2path".
Description: Specifies name and/or location of an application shortcut file. If specified, the value must be of one of the following three types: 1) a file name with .url extension - that will be placed in the shared desktop folder; 2) a full path to a .url file to be created in an existing folder, and 3) path to an existing folder where the file matching application name plus .url extension will be created. If value is not specified, path to shared desktop folder is used.

SHORTCUT2HOST, type: String.
Recognized parameter name variations: "shortcut2hostname", "sc2host".
Description: A host or IP address to be used in the application URL. If not specified, default hostname will be used. Default host name is machine's fully-qualified domain name (FQDN) if computer is a member of a domain, or machine name if computer is a member of a workgroup. Special name "*IOS*" can be specified to create iPhone/iPad-friendly link in the "machinename.local" format, if computer is a member of a workgroup, or just the machine name if computer is a member of a domain.

SHORTCUT2PATHNAMEANDQUERYSTRING, type: String.
Recognized parameter name variations: "shortcut2pnqs", "sc2pnqs".
Description: An optional site-relative path to an application start page and/or query string.

SHORTCUT2ICONFILE, type: String.
Recognized parameter name variations: "shortcut2iconpath", "shortcut2icon", "sc2icon".
Description: An optional path to a file containing an icon for the application shortcut. Can be a path to an .ICO, or an executable file like .EXE or .DLL. If not specified, a path to "UWS.Explorer.exe" is used.

SHORTCUT2ICONINDEX, type: UInt16.
Recognized parameter name variations: "sc2iconindex", "sc2iindex".
Description: An optional icon index in the icon file specified by "shortcuticonfile" parameter. Default value is 0.

SHORTCUT3LOCATION, type: String.
Recognized parameter name variations: "shortcut3", "shortcut3path", "sc3path".
Description: Specifies name and/or location of an application shortcut file. If specified, the value must be of one of the following three types: 1) a file name with .url extension - that will be placed in the shared desktop folder; 2) a full path to a .url file to be created in an existing folder, and 3) path to an existing folder where the file matching application name plus .url extension will be created. If value is not specified, path to shared desktop folder is used.

SHORTCUT3HOST, type: String.
Recognized parameter name variations: "shortcut3hostname", "sc3host".
Description: A host or IP address to be used in the application URL. If not specified, default hostname will be used. Default host name is machine's fully-qualified domain name (FQDN) if computer is a member of a domain, or machine name if computer is a member of a workgroup. Special name "*IOS*" can be specified to create iPhone/iPad-friendly link in the "machinename.local" format, if computer is a member of a workgroup, or just the machine name if computer is a member of a domain.

SHORTCUT3PATHNAMEANDQUERYSTRING, type: String.
Recognized parameter name variations: "shortcut3pnqs", "sc3pnqs".
Description: An optional site-relative path to an application start page and/or query string.

SHORTCUT3ICONFILE, type: String.
Recognized parameter name variations: "shortcut3iconpath", "shortcut3icon", "sc3icon".
Description: An optional path to a file containing an icon for the application shortcut. Can be a path to an .ICO, or an executable file like .EXE or .DLL. If not specified, a path to "UWS.Explorer.exe" is used.

SHORTCUT3ICONINDEX, type: UInt16.
Recognized parameter name variations: "sc3iconindex", "sc3iindex".
Description: An optional icon index in the icon file specified by "shortcuticonfile" parameter. Default value is 0.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Ultidev Team
#3 Posted : Saturday, September 29, 2012 3:23:26 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,063

Thanks: 28 times
Was thanked: 35 time(s) in 34 post(s)
Registering web apps with UWS using COM API

UWS Application Configuration API is accessible as .NET API, and as a COM API. COM API is useful for installation authoring tools that rely on Visual Basic/VBS/VBA as a scripting tool.

Here's a code snippet for registering/unregistering a web application using VBS. Attached ZIP file has more samples of using UWS COM API for application registration and unregistration.
Code:

' (C) UltiDev LLC, 2011
' Demo script showing how to use COM automation client
' to register an application with UltiDev Web Server Pro.

Option Explicit

'On Error Resume Next
Dim mb : set mb = Nothing
set mb = Wscript.CreateObject("UltiDev.WebServer.MetabaseComServer.1") : CheckError

Register	' Register the application
'Unregister ' Unregisters the application

Sub Register

    ' CLR version enum:
    const RuntimeVersion_AspNet_1_2or3x = 2
    const RuntimeVersion_AspNet_4 = 4

    ' Process identity enum:
    const ProcessIdentity_NetworkService = 0
    const ProcessIdentity_LocalSystem = 1

    Dim app : set app = Nothing
    Set app = mb.GetWebAppEntry("{0E801A51-1579-411B-82B7-5ABC0E49BA54}", True) : CheckError
    
    app.ApplicationName = "COM-registered app"

    app.ApplicationDescription = "Registered at " + CStr(Now)
    app.PhysicalDirectory = "C:\Program Files\UltiDev\Web Server\Redirector"
    app.DefaultDocument = "Default.aspx"
    
    Dim ep : set ep = app.Endpoint
    ep.VirtualDirectory = "COMApp"
    ep.ListenAddresses.Add "http://*:7315"
    
	' If you get an error here, please run the script as Aministrator/Elevated user.
    mb.RegisterApplication1Disp RuntimeVersion_AspNet_1_2or3x, false, ProcessIdentity_LocalSystem, app

    Wscript.Echo "Registration completed"
End Sub

Sub Unregister
    mb.UnregisterApplication "{0E801A51-1579-411B-82B7-5ABC0E49BA54}"
    Wscript.Echo "Unregistration completed"
End Sub

Sub CheckError
	If Err = 0 Then Exit Sub
	Dim message, errRec
	message = Err.Source & " " & Hex(Err) & ": " & Err.Description
	Fail message
End Sub

Sub Fail(message)
	Wscript.Echo message
	Wscript.Quit 2
End Sub
File Attachment(s):
UWS.COM.API.Samples.zip (3kb) downloaded 120 time(s).
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Quick Reply Show Quick Reply
Rss Feed  Atom Feed
Users browsing this topic
Guest (12)
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.