How to Build an IIS Deployment Package

Description

If there is completely no access to the IIS server, Alpha Anywhere does not currently support creating a package that can be independently deployed on the IIS server. However, by using the following steps, a deployment package can be created outside of Alpha Anywhere.

The following instructions assume that Application Initialization is installed in IIS. Refer to the Installation Guide for more about Application Initialization.

  1. WebDeploy needs to be installed on the client/developer machine and the server/IIS machine.

  2. Publish the application to localhost on the client/developer machine.

  3. Portions of the web.config file may be encrypted to protect passwords for some settings, e.g. connection strings. An example of an encrypted section looks like this:

    • <connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
          <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
            xmlns="http://www.w3.org/2001/04/xmlenc#">
            <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
            <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
              <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
                <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
                <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
                  <KeyName>Rsa Key</KeyName>
                </KeyInfo>
                <CipherData>         <CipherValue>Y28XAy79FHqQIxn5UPM3oF8SDz6cvBcfoIPD39mIwhwQq5RqsgdsyARcAkLjQ5I3t5kVd/KqBs/zECgxjRVIXQ5XJL/a9DeAsUuk5g88sTqqSUmBCyXE/jzChaqK6/Wz7UJhwI4e1Ixg6+BBMJM0p/A38beclGsCUlwwlML6q9tx8cfLltgtu3MP24iiYQbxU4WmxjEJLuhd3F56C7KrYYdQzTNPH7sL7sqW387AkAk1BhljgCIC3xbz9pO9SMElxvMAzM0KJA1UBS9Yote/Nb3g+NEXhiW8i2dh3+n8Sr+XFXs2c0qndeD7gGQALtVdwKApi4OM02vqCGAQZ7h3Rw==</CipherValue>
                </CipherData>
              </EncryptedKey>
            </KeyInfo>
            <CipherData>       <CipherValue>IbRBhhWQIwVKF0swwKzZNQxPZCaQn7SUJJZGvhkWAXkeFs4RJUHUJ5ytXzCmnbeAcUtpjbUdybcxI4NKnYQ51oHjIC7iezHpp70IlFOi8H1MrUwpVsrfhGxwv5S2NfjBkUaFtYNylwrvixRy7/4oyGEOmBdiuUn8E+pXrpdIBUXYxz/lX1Pt4IihGT4enEoaiM/EFyGmuz2dfM2Fb31Cd6MhPY9TiUxNWnXBSVbctD2c+W1cgcmZmcjaFS4aGG5BVyNFUuB4tElRB/Utp7kK2XSl+ff+xAXt9OrmghtCVSvO9Npa730uxFfZt2gUT9FryYqeyFlxtawIAazwIEp1z+yM0XVKVocA</CipherValue>
            </CipherData>
          </EncryptedData>
      </connectionStrings>
    • These sections will need to be decrypted before exporting the application. To decrypt a section open a command line as administrator and run the following command:

      c:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pd "connectionStrings" -site "Default Web Site" -app "/TestApp"
    • The example encrypted section above is for connectionString and uses the XML tag <connectionStrings>. Use the section name for the command line argument after the -pd. This is a case sensitive value and use it without the surrounding "<" and ">" characters. Use the name of the site as it appears in IIS Manager for the -site argument, and use the application name for the -app argument. This must be prefixed with a forward slash "/". If the application has no name and is therefore the default app, use "/" for the -app name.

      Other sections that could be encrypted are

      system.web/membership
      system.web/roleManager
    • Once the app is deployed to the new location, the sections can be encrypted again. That will be in a step below.

  4. Go into IIS Manager and right click on the application and choose Deploy > Export Application...

    images/deployPackage2.png
  5. Follow the prompts to create a deployment package.

  6. Move the deployment package to the server/IIS machine

  7. Create a new application pool in IIS Manager setting

    .NET Framework Version

    v4.0

    Enable 32-Bit Applications

    True

    Managed Pipeline Mode

    Integrated

    Start Mode

    AlwaysRunning

    Maximum Worker Processes

    5 (this may be set to more if needed.)

    images/deployPackage2b.png
  8. Right click on the site the app will be deployed. Select Deploy > Import Application...

    images/deployPackage3.png
  9. Select the application in IIS Manager and display the Basic Settings...

    images/deployPackage4.png
  10. Set the Application Pool to the one created earlier

  11. Check Enable Preload

    images/deployPackage5.png
  12. To ensure the application has proper access to the folders the A5IISDeploy.exe utility will need to be run. To do this, open a cmd prompt using Run as Administrator and run the following command:

    • "C:\Program Files (x86)\A5V12 Application Server for IIS\A5IISDeploy.exe" SiteName="Default Web Site" ApplicationName="/TestApp" GrantAppPoolAccountPermissions WebConfigSize
    • This will grant permissions in required folders to the account used by the application's application pool. It will also verify the allowable maximum web.config file size and increase the allowable size if needed. The example above uses the default installation folder "C:\Program File (x86)\A5V12 Application Server for IIS". The SiteName and ApplicationName parameters are also examples. Use the site name for your application as it is named in IIS Manager, and if the application is the default application use "/" for the ApplicationName parameter value.

    • If the application uses node services also use the DeployNodeServices parameter:

    • "C:\Program Files (x86)\A5V12 Application Server for IIS\A5IISDeploy.exe" SiteName="Default Web Site" ApplicationName="/TestApp" GrantAppPoolAccountPermissions WebConfigSize DeployNodeServices
  13. If any web.config sections were decrypted in a previous step, now they can be encrypted again. The open a command line as administrator and run the same command as for decrypting above except change the -pd argument to -pe:

    • c:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pe "connectionStrings" -site "Default Web Site" -app "/TestApp"
    • This shows the connectionString section being encrypted. Run the command for any of the other sections that were decrypted substituting that section name for the "connectionStrings" argument.

  14. Start the application pool and test the application.