VERIFIED SOLUTION i

Portrait Foundation - Bad return HTML from model resumption error

Issue

DESCRIPTION

When launching the Portrait Foundation Contact Centre, Agent Manager or any HTA based application, you may received the error "Bad return HTML from model resumption".  This is typically seen on a newly installed Portrait Foundation system having run the Contact Centre for the first time, and is an indication that there is fundamental problem in launching the Portrait code at the web tier.

Cause

POSSIBLE CAUSES

There are several possible causes.

Incompatible Core Software and Implementation Versions
One common reason for this problem is that the versions you have installed of the core software and the Portrait implementation do not match.  For example, you have installed Portrait version X and Portrait Implementation version X, you then install an Update to Portrait version Y (eg version X update Y) but do not install the same Update to the Portrait Implementation.  This results in the Implementation looking for earlier versions of the Portrait DLLs in the GAC from those that are now present, and you will get this error message. To fix in this case, install the correct build of the Portrait Implementation.

.Net Web Service Extensions Disabled
If the .Net 2.0 (Foundation v4.0) or .Net 4.0 (Foundation v4.3 onwards) Web Service Extensions (within IIS Management Console) are disabled.  This will show up as HTTP 404 errors in the IIS server logs.  Providing there are no other contributing factors, simply enabling the appropriate .Net web service extensions in IIS Management Console will immediately resolve the issue without need to re-install or reboot.

IIS Core Components Not Installed
On Windows 2008 based platforms, the way IIS is installed is by selected very granular individual components (features) to be installed. If the correct list of features is not installed, you may experience this error or other errors where the Portrait Contact Centre application partially works. Consult the Portrait Installation Guide for further details of pre-req IIS components on Windows 2008 (or later) platforms.

64-bit installation?
Make absolutely sure that you have followed the extra guidelines in the Portrait Installation document regarding 64-bit installs. Notably, you need to ensure that the IIS Application Pool that you are using has been set to be enabled for 32-bit applications (right-click the App Pool, select Advanced Settings...). Also, you will need to have installed the 32-bit version of ASP.Net using the following command:

    %SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

Resolution

UPDATED: March 23, 2017

HOW TO DIAGNOSE

Step 1
In AIT_HRZ_ContactCentre.hta, within the StartPage() function, change
   blnDebugMode = false;
to be
   blnDebugMode = true;

When you re-run the contact centre, you will get a more detailed error message as the reason behind the "Bad Return from HTML".  The detailed error message may then suggest a possible cause to investigate.

In the case of mismatching base and implementation installs, the error message will indicate a problem loading one of the Portrait GAC DLLs, typically AIT.Portrait.Web.

Step 2
The error often occurs because of a catastrophic failure to execute the .Net page in IIS. Look at the error code from executing the page by checking the IIS log file in C:\WINDOWS\SYSTEM32\LogFiles\W3SVC1

Look at the most recent log file, typically one dated today, and got to the end of the file - you can view the file in Notepad.  By default, the right most column of each line is the SC-Status field (the status of the server request).  For a successful page execution, this code will be 200 - although some other codes are also valid.  Of particular note should be any .aspx or .amc pages that have a code of 500 (IIS internal error) or 404 (file not found).

If you get a 404 or 500 error, check that the page in question does actually existing the specified directory. 
If it does, then it is also possible that the page type is disallowed within IIS. 
Within the IIS Manager MMC, under the Web Services Extensions option, check that "ASP.Net v.x.xx.xx" is set to "Allowed".

Step 3

If you still can't identify the cause, then start at the basics and verify that you can successfully execute a non-Portrait page.

1) Create a basic .htm page in notepad with just the word "test" in it, save it into a suitable IIS directory such as C:\Inetpub\wwwroot then browse to that page using Internet Explorer. 
You should be able to view this basic HTML page.  If not, there is something fundamentally wrong with the IIS installation on the machine.
2) Now rename the .htm page to be .asp and try to browse to it again. This will serve the page via the IIS ASP engine. Again, this should be successful because it is quite straight forward.
3) Now rename the .asp page to be .aspx and try to browse to it again. This will now serve the page via the ASP.Net engine. If this is unsuccessful, then the problem is to do with the ASP.Net installation on the machine. It is usually possible to correct any issues with ASP.Net installation by running the Aspnet_regiis.exe utility from the relevant .Net framework directory.  Run Aspnet_regiis.exe /? to get the parameters to use, or see the Microsoft website for extra help.

NB: From Portrait release 4.0 the .NET 2.0 Framework is used. So you will need to use the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 folder.

From Portrait release 4.3 the .NET 4.0 Framework is used. So you will need to use the C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319 folder.

Step 4

Ensure that the .amc files are registered against ASP.NET. Right-click on the application's virtual directory and select Properties. Select the Configuration... button on the Virtual Directory tab. Check to see whether the .amc extension is in the list. If not select the Add... button. Enter C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll as the Executable, .amc as the Extension and Limit to: GET,HEAD,POST,DEBUG.  Ensure that 'Verify that file exists' is not checked - there are no .amc files.

NB: From Portrait release v4.3 onwards the .NET 4.0 Framework is used. So you will need to use the C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319 folder.

Step 5

If you are using Windows Server 2003 check that the correct ASP.NET Web Service Extensions are set to "Allowed". Open Internet Information Services (IIS) Manager and click on Web Service Extensions.

For Portrait releases between v4.0 and v4.3, ASP.NET v2.0.50727 needs to be allowed. For releases 4.3 onwards, ASP.NET v4.0.30319 needs to be allowed.

Step 6

Contact Portrait Support if you have tried all of the above.

Environment Details