ERROR: APPLICATION_HOST_ERR_ON_APP_INIT: Failed to initialize the hosted application

Jul 13, 2010 at 5:06 PM

Hi, I was trying to reproduce the  demo in CCA 300/400 by I am facing with this ERROR:

APPLICATION_HOST_ERR_ON_APP_INIT: Failed to initialize the hosted application #######  ( where ### is the name of the Hosted Application created)

I Created a Case and KMI applications in CRM and then I imported to Visual Studio.. There I inspected them and created some controls (just like the Demo).. When I finished my Workflows, I Built my application and go to the BIN folder of my project to locate the .dll file and .pdb file. I used this path to put in on the Adapter in the UII Action created.. and I modified the Adapter Configuration of the Hosted Applications created to "Use Automation Adapter (HAT)".. Then I created my Workflow and everythings is fine, just like the Demo..

When I open my IAD, the error is deployed inmediatly for the Hosted Application that is GLOBAL..  and then, when I want to use my workflow and clic on the first step in my WF that open the Case (Web Application Dependent of Workflow) the error is showed again and this provokes the instructions in the WF dont work..

I have tried everything, I modified the path on the Adapter into the UII Action, I read post and copy .dll in the same folder of agentdesktop.exe, I automatizated all  and nothing is working..

Can you help me how to debug this error or how to know what is failing please.

Thanks.....

Jul 14, 2010 at 8:23 PM

If you do not Publish your HAT enable applications from the HAT Toolkit in VS, it will be missing a bit of XML in the Automations Tab of the hosted control configuration

You can fix it by opening the hosted control config in UII Settings, Choosing the Automations Tab and posting this XML to it:

 <DataDrivenAdapterBindingsCollection>
  <DataDrivenAdapterBindings>
    <Type>Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.WinDataDrivenAdapter, Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter</Type>
    <Controls />
  </DataDrivenAdapterBindings>
</DataDrivenAdapterBindingsCollection>

Let me know if that sorts out your problem

MattB-MSFT

Jul 15, 2010 at 5:02 PM

Hi Matt Thank you very much...

I couldnt publish HAT enable applications from the HAT toolkit in VS (because I dont know how.. if you can tell me please i would appreciate it).. but I put mannually the XML in Automations Tab of the hosted control config..

When I did that, my IAD stopped throwing the past error, but my workflows and UII Actions dont function now.. I Installed the UIIDebugger.. and this is the deployed UIIDebugger's output when I try to execute the steps on my workflow (I change the font color to see where two  steps are called (steps 2 and 3 of my WF.. step 1 is a default and doesnt require automation, and only function when I set No adapter in Adapter Configuration.. so there is not trace for step 1)):

 

2010-07-15 10:13:11: UiiDebugger: Context = <UiiContext><CustomerFirstName>Rodolfo</CustomerFirstName><Email1>rodolfo@contoso.com</Email1><ZipCode>77432</ZipCode><State>Mexico</State><Phone2></Phone2><BillingAddress>Fundadores 5090
Mexico Mexico, 77432</BillingAddress><CustomerLastName>Paez</CustomerLastName><Phone1>982982982930</Phone1><CustomerName>Rodolfo Paez</CustomerName><IsNewCustomer>False</IsNewCustomer><AccountName></AccountName><CustomerType>contact</CustomerType><AccountID></AccountID><City>Mexico</City><CustomerID>c9b62b11-7d6a-df11-8b9b-00155d018007</CustomerID><Country>Mexico</Country><Street>Fundadores 5090</Street></UiiContext>
2010-07-15 10:13:16: WF/Automation 5423b975-8670-4d84-b869-492ca9870158 started: application=KMI,action=Search KB,data=,async=True
2010-07-15 10:13:16: AutomationAdapter (app=Case,action=__GetControlValue__): Posted implicit action exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DataDrivenAdapterException (op=GetControlValue,controlName=CaseTitle): DDA0101: Named control configuration not found.
2010-07-15 10:13:16: WF/Automation 5423b975-8670-4d84-b869-492ca9870158 exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DataDrivenAdapterException (op=GetControlValue,controlName=CaseTitle): DDA0101: Named control configuration not found.
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationAdapter.AdapterFireActionFromAutomation(String applicationName, String actionName, Object data)
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationBridgeService.GetControlValue(String applicationName, String controlName)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.GetControlValue.ExecuteImpl(ActivityExecutionContext context, AutomationBridgeService service)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.HatActivityBase.Execute(ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
   at System.Workflow.Runtime.Scheduler.Run()
2010-07-15 10:13:16: WF/Automation 5423b975-8670-4d84-b869-492ca9870158 terminated (duration 94ms)
2010-07-15 10:13:30: WF/Automation 390be12c-cae7-4e18-be52-21c000a27a8f started: application=Case,action=Copy Article,data=,async=True
2010-07-15 10:13:30: AutomationAdapter (app=KMI,action=__GetControlValue__): Posted implicit action exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DataDrivenAdapterException (op=GetControlValue,controlName=SelectedKB): DDA0101: Named control configuration not found.
2010-07-15 10:13:30: WF/Automation 390be12c-cae7-4e18-be52-21c000a27a8f exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DataDrivenAdapterException (op=GetControlValue,controlName=SelectedKB): DDA0101: Named control configuration not found.
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationAdapter.AdapterFireActionFromAutomation(String applicationName, String actionName, Object data)
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationBridgeService.GetControlValue(String applicationName, String controlName)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.GetControlValue.ExecuteImpl(ActivityExecutionContext context, AutomationBridgeService service)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.HatActivityBase.Execute(ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
   at System.Workflow.Runtime.Scheduler.Run()
2010-07-15 10:13:30: WF/Automation 390be12c-cae7-4e18-be52-21c000a27a8f terminated (duration 47ms)

 

 

I understand in the ouput that the controls dont function.. but when I inspect the XML file of the application in HAT Harness, everything is fine and the controls Sets, Gets and Executes fine.  Why it is happening ?

 

Thanks

Jul 15, 2010 at 8:35 PM

Well On the bright side, your now getting to the “real” error J..

The error your seeing below is because do you do not have the control map in the automations node either.

So lets take this in turns..

The Easiest way to fix this, is to publish your app from HAT in visual studio to the UII\CRM server. To do that, In your project in Visual Studio, right click the application and choose “Deploy to Server”. That will pop a dialog that will ask for Service URL. This is the URL to the CRMService for your server, so if its local and default.. : http://localhost:5555/MSCrmServices/2007/CrmService.asmx

Then you need to put the org name and hit “deploy”

That will setup your application, register your mapped controls, and register the default automation. You will need to go in and setup the rest of the automations as actions in the UII settings.

Once that is done you should notice a lot of stuff on the Automations Tab.

If that works for you, you should be good to go and debugging your actual automations.

If it does not, then we can do it the “manual” way ...

** Note that the deploy process will only work on CRM instances that do not require you login, IE your windows credentials are the same as your CRM credentials.

 

MattB-MSFT

Jul 16, 2010 at 10:30 PM

Hi Matt...Thanks... It worked!! Now the error is other..

I am having troubles because My Workflow Sequence is just like the Demo in CCA 300/400 video:  

1- Create Service Request (opens a 'Case' window with the selected Customer, depending the Customer)

2- SearchKB (Get Value of 'CaseTitle' and copy it in the Search input on the Hosted App 'Knowledge Management' and clic the button 'Search' and select the one http://###/####/cs/dialogs/KBSearch.aspx?isLookup=true )

3- CopyArticle (Copy the selected article in the 'Case' window in 'Notes and Article' tab.

 

First Im having problems with my automation workflow to step 1. I created a workflow with two activities GetContext, and Navigate.. Im trying to Get the CustomerID with GetContext and then in Navigate i tried to concatenate the URL like this:

navigate1.Url = "http://localhost:5555/CRMR2FULL/cs/cases/edit.aspx?_CreateFromType=2&_CreateFromId=" + getContext1.ContextValue;

but the getContext1.ContextValue is empty and in the WF, when I clic on Step1 the Case Web App is with a CRM Error... so I tried putting a Valid Guid and the Case App is open correctly with the Customer selected.

<font size="2">

navigate1.Url =

</font>http://localhost:5555/CRMR2FULL/cs/cases/edit.aspx?_CreateFromType=2&_CreateFromId=C9B62B11-7D6A-DF11-8B9B-00155D018007;

the other steps Im worried because I did everything like the demo and the workflows are fine and when I look at the UIIDebugger it deploys this:

2010-07-16 13:23:55: UiiDebugger: Context = <UiiContext><CustomerFirstName>Rodolfo</CustomerFirstName><Email1>rodolfo@contoso.com</Email1><ZipCode>77432</ZipCode><State>Mexico</State><Phone2></Phone2><BillingAddress>Fundadores 5090
Mexico Mexico, 77432</BillingAddress><CustomerLastName>Paez</CustomerLastName><Phone1>982982982930</Phone1><CustomerName>Rodolfo Paez</CustomerName><IsNewCustomer>False</IsNewCustomer><AccountName></AccountName><CustomerType>contact</CustomerType><AccountID></AccountID><City>Mexico</City><CustomerID>c9b62b11-7d6a-df11-8b9b-00155d018007</CustomerID><Country>Mexico</Country><Street>Fundadores 5090</Street></UiiContext>
2010-07-16 13:24:03: WF/Automation 99a3295e-ea1c-462d-8473-cd545bd2f3b4 started: application=KMI,action=Search KB,data=,async=True
2010-07-16 13:24:07: AutomationAdapter (app=KMI,action=__ExecuteControlAction__): Posted implicit action exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DDA0304: Html element is not a <button/> element.
2010-07-16 13:24:08: WF/Automation 99a3295e-ea1c-462d-8473-cd545bd2f3b4 exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DDA0304: Html element is not a <button/> element.
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationAdapter.AdapterFireActionFromAutomation(String applicationName, String actionName, Object data)
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationBridgeService.ExecuteControlAction(String applicationName, String controlName)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.ExecuteControlAction.ExecuteImpl(ActivityExecutionContext context, AutomationBridgeService service)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.HatActivityBase.Execute(ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
   at System.Workflow.Runtime.Scheduler.Run()
2010-07-16 13:24:08: WF/Automation 99a3295e-ea1c-462d-8473-cd545bd2f3b4 terminated (duration 4360ms)
2010-07-16 16:33:27: WF/Automation 4affbea9-f5af-41fb-b7f4-54611acba838 started: application=Case,action=Copy Article,data=,async=True
2010-07-16 16:33:28: AutomationAdapter (app=Case,action=__SetControlValue__): Posted implicit action exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DataDrivenAdapterException (op=SetControlValue,controlName=ArticleKB): DDA0108: Unsupported operation on control.
2010-07-16 16:33:28: WF/Automation 4affbea9-f5af-41fb-b7f4-54611acba838 exception: Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DataDrivenAdapterException (op=SetControlValue,controlName=ArticleKB): DDA0108: Unsupported operation on control.
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationAdapter.AdapterFireActionFromAutomation(String applicationName, String actionName, Object data)
   at Microsoft.Uii.HostedApplicationToolkit.AutomationHosting.AutomationBridgeService.SetControlValue(String applicationName, String controlName, String controlValue)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.SetControlValue.ExecuteImpl(ActivityExecutionContext context, AutomationBridgeService service)
   at Microsoft.Uii.HostedApplicationToolkit.Activity.HatActivityBase.Execute(ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
   at System.Workflow.Runtime.Scheduler.Run()
2010-07-16 16:33:28: WF/Automation 4affbea9-f5af-41fb-b7f4-54611acba838 terminated (duration 1235ms)

 

The controls dont work but with  Test Harness everything is fine (except in a PartyList I cant use a SetValue)..... What i am missing?

Analaurette

Jul 28, 2010 at 4:25 PM

Hi Matt.. do you know why is happening this to me? I have tried everything and nothing is changing.. if somebody knows whats wrong I will appreciate it too much.. Thanks.

Jul 29, 2010 at 3:59 AM

Sorry, traveling quite a bit and miss the reply’s some times.
Timing is important here… are you triggering the automation on “Default” or at some other point?

Default is a bad place to do UI affecting automations…

For the second part, I would guess that your running into a problem where the right form not in scope when HAT tried to act on it.

Can you email me your HAT project so I can see what you’re doing?

MattB-MSFT

Jul 29, 2010 at 6:06 PM

Hi Matt... I will email you my project and some printscreens about the Hosted Applications and the main Workflow.

Im in trouble with the URL to get the user.. In the Code I used a static GUID (Second line) because I cant concatenate the URL .. need help with this please. 

navigate1.Url = "http://localhost:5555/CRMR2FULL/cs/cases/edit.aspx?_CreateFromType=2&_CreateFromId=" + getContext1.ContextValue;

navigate1.Url =http://localhost:5555/CRMR2FULL/cs/cases/edit.aspx?_CreateFromType=2&_CreateFromId=C9B62B11-7D6A-DF11-8B9B-00155D018007

 

the other errors are in the workflow functionallity.. .Thanks Matt.. 

 

Jul 29, 2010 at 6:09 PM
Hi Matt... I will email you my project and some printscreens about the Hosted Applications and the main Workflow.
Im in trouble with the URL to get the user.. In the Code I used a static GUID (Second line) because I cant concatenate the URL .. need help with this please.


navigate1.Url = "http://localhost:5555/CRMR2FULL/cs/cases/edit.aspx?_CreateFromType=2&_CreateFromId=" + getContext1.ContextValue;

navigate1.Url =http://localhost:5555/CRMR2FULL/cs/cases/edit.aspx?_CreateFromType=2&_CreateFromId=C9B62B11-7D6A-DF11-8B9B-00155D018007

the other errors are in the workflow functionallity.. .Thanks Matt..


Ana Laura Félix M





From: [email removed]
To: [email removed]
Date: Wed, 28 Jul 2010 19:59:53 -0700
Subject: Re: ERROR: APPLICATION_HOST_ERR_ON_APP_INIT: Failed to initialize the hosted application [crmcca:219311]

From: MattB_MSFT
Sorry, traveling quite a bit and miss the reply’s some times.
Timing is important here… are you triggering the automation on “Default” or at some other point?

Default is a bad place to do UI affecting automations…
For the second part, I would guess that your running into a problem where the right form not in scope when HAT tried to act on it.
Can you email me your HAT project so I can see what you’re doing?
MattB-MSFT
Read the full discussion online.
To add a post to this discussion, reply to this email (crmcca@discussions.codeplex.com)
To start a new discussion for this project, email crmcca@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Jul 30, 2010 at 4:25 PM

Hi Matt. can you confirm me when you receive the files, please? because I only replied.

Jul 31, 2010 at 2:24 PM

If you click on my name to the left, and jump to my profile, there is a contact link that will open in a page, drop me a mail there and I will respond via Email and we can get this sorted out. :)

Mattb-msft.

Aug 16, 2010 at 3:46 PM
 
 
Hi Matt!! Thank you very much for your help .. Now im more oriented..
 
I tried creating a new workflow named default.cs and there I add a Register Action for Event with these characteristics:
 
 
Name: registerActionForEvent1
ActionApplicationName: Case
ActionName: Workflow4
ApplicationName: Case
Enabled: True
EventName: ContextChanged

I Rebuilded my project to generate the new WorkflowLibrary1.dll... and I modified in Hosted Applications in CRM in the Case entry, the default, saying to the Automation this:
WorkflowAssemblyType: WorkflowLibrary1.default, C:\Program Files (x86)\Microsoft Uii\CCA\Source Code\AgentDesktop\bin\Release\WorkflowLibrary1.dll
 
But it didnt work.. I think it is not entering to Workflow4 and I dont know how to debug the Workflow, cause the UIIDebugger doesnt say anything...
 
am I missing something?
 
Regards,
 
 
Ana Laura Félix M
 
 
 
----------------------RESPONSE FROM ------------------------
 
Ok… finally got a chance to look at this.
First issue I see is that your default workflow, ( which is set to workflow4 ) is doing a context get straight away ..
Default action is often called before the first notify context so its going to be empty… so if you want to hook that, you want to set up a register for event for the Notify Context event, and then fire workflow 4 off that.
 
I would suggest you create a new workflow, and call it default  ( will keep it straight in your code ),  then add a Register for event Shape and register for the ContextChange Event…  the syntax and such you can find here.  http://blogs.msdn.com/b/mbarbour/archive/2010/07/08/a-few-undocumented-events-in-the-hosted-application-toolkit.aspx
Remember to update your Default action in CRM for it as well.
 
That should sort it out for you
MattB.
Aug 18, 2010 at 11:21 PM

 

Replied in Email with a working example.

Mattb.