none
Error when publishing WF containing custom code activity to workflow manager 1.0

    Pergunta

  • Hello:

    Workflow manager sounds every exciting to me, I am trying it out to see if it will work for me.

    I downloaded "CustomCodeActivitySample" of workflow manager 1.0, and when I ran, I got following exception:

    Workflow XAML failed validation due to the following errors:
    Cannot create unknown type '{clr-namespace:HashActivity;assembly=HashActivity}ComputeHash'. HTTP headers received from the server - ActivityId: 2a1e4d9d-90bd-4f59-a1fc-d3673194dd54. NodeId: NDL0714. Scope: /CustomCodeActivitiesSample. Client ActivityId : 235d66c1-bbe6-4982-8242-833a6bc1f6b1.

    more details:

    Microsoft.Workflow.Client.ActivityValidationException was unhandled
      HResult=-2146233088
      Message=Workflow XAML failed validation due to the following errors:
    Cannot create unknown type '{clr-namespace:HashActivity;assembly=HashActivity}ComputeHash'. HTTP headers received from the server - ActivityId: efe2c3cb-e6fd-4124-88a1-6c8e72aecb06. NodeId: NDL0714. Scope: /CustomCodeActivitiesSample. Client ActivityId : 73d7b773-be53-4a7b-b2d8-ba687e60a4f4.
      Source=Microsoft.Workflow.Client
      ActivityName=ProcessMovies
      ScopePath=/CustomCodeActivitiesSample
      StackTrace:
           at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)
           at Microsoft.Workflow.Client.WorkflowManagementClient.SendRequest[T](HttpWebRequest request, T content)
           at Microsoft.Workflow.Client.ActivityManager.Publish(ActivityDescription description, Boolean overwriteXClassName, Boolean terminateDependentInstances)
           at Microsoft.Workflow.Client.ActivityManager.Publish(ActivityDescription description)
           at Microsoft.Workflow.Samples.Common.WorkflowManagementClientExtensions.PublishWorkflow(WorkflowManagementClient client, String workflowName, String xamlFilePath, Collection`1 externalVariables, IDictionary`2 configValues, SubscriptionFilter activationFilter) in c:\WFM_C\C\Microsoft.Workflow.Samples.Common\WorkflowManagementClientExtensions.cs:line 45
           at Microsoft.Workflow.Samples.Common.WorkflowManagementClientExtensions.PublishWorkflow(WorkflowManagementClient client, String workflowName, String xamlFilePath, SubscriptionFilter activationFilter) in c:\WFM_C\C\Microsoft.Workflow.Samples.Common\WorkflowManagementClientExtensions.cs:line 29
           at CustomCodeActivitySample.Program.Main(String[] args) in c:\WFM_C\C\CustomCodeActivitySample\Program.cs:line 39
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.Net.WebException
           HResult=-2146233079
           Message=The remote server returned an error: (400) Bad Request.
           Source=Microsoft.Workflow.Common
           StackTrace:
                at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
                at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.End(IAsyncResult result)
                at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)
           InnerException:

    Thanks


    ahorse

    terça-feira, 27 de novembro de 2012 15:22

Todas as Respostas

  • Hello ahorse,

    Did you copy the dll files with the activities and types into C:\Program Files\Workflow Manager\1.0\Workflow\WFWebRoot\bin and C:\Program Files\Workflow Manager\1.0\Workflow\Artifacts?

    Once you do that you also need to make sure its allowed in the trusted surface. If this is just a dev box you can follow the steps here http://msdn.microsoft.com/en-us/library/windowsazure/jj193517(v=azure.10).aspx#BKMK_DisableDefaultProtection

    Regards

    quarta-feira, 13 de fevereiro de 2013 17:20
  • Hello, Did you manage to solve this?

    I'm having the exact same problem. I created a CustomCode activity and copied the dll files with the activities and types into C:\Program Files\Workflow Manager\1.0\Workflow\WFWebRoot\bin and C:\Program Files\Workflow Manager\1.0\Workflow\Artifacts, and just in case I also disabled the default protection but I'm still getting the following exception everytime I try to run a workflow that uses that CustomCode activity:

    Dispatcher encountered an unexpected exception:

    System.Xaml.XamlObjectWriterException: Cannot create unknown type '{clr-namespace:ActivityLibraryTest1;assembly=ActivityLibraryTest1}PrintStuff'.
       at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at Microsoft.Activities.Dispatcher.DispatchLoopInstanceAsyncResult.WorkflowSessionCreated(IAsyncResult result)
       at Microsoft.Activities.Dispatcher.DispatchLoopInstanceAsyncResult.Isolate(AsyncCompletion callback, IAsyncResult result)
       at Microsoft.Activities.Dispatcher.DispatchLoopInstanceAsyncResult.ExceptionHandlingFrame(IAsyncResult result)

    sábado, 16 de fevereiro de 2013 16:32
  • Z731137Z,

    I just want to clarify that you get this error when you try to execute the workflow? So you were able to upload and translate an activity that used your custom code activity but you get this error when executing it?

    Thanks,
    Kent

    terça-feira, 19 de fevereiro de 2013 15:35
  • Hi

    I had the same problem. The reason was in 2 factors: the dll in Workflow Manager dirs were not updated and also the service was not restarted.

    I use post build command to deploy my activity libraries to WFM:

    xcopy "$(TargetPath)" "C:\Program Files\Workflow Manager\1.0\Workflow\WFWebRoot\bin" /Y
    xcopy "$(TargetPath)" "C:\Program Files\Workflow Manager\1.0\Workflow\Artifacts" /Y
    net stop "Workflow Manager Backend"
    net start "Workflow Manager Backend"

    Note that you many need to run VS.Net as admin and depending on whether you disabled trusted surface in WFM or not you may need to also deploy AllowedTypes.xml

    Hope this helps.


    • Sugerido como Resposta adnecs domingo, 24 de março de 2013 20:36
    • Editado adnecs domingo, 24 de março de 2013 20:39
    domingo, 24 de março de 2013 20:36
  • This shouldn't be an issue with the samples, but if you are creating your own custom activity (either code based or declarative) you need to have the following lines in the AssemblyInfo.cs for the activity library project that contains the custom activities or else you will get errors similar to the following:

    System.Xaml.XamlObjectWriterException: Cannot create unknown type '{clr-namespace:WFMgrHOLActivities}GetProducts'.

    If this error occurs when you publish a workflow that references a previously published activity, check the following items.
    Open the Assembly.cs of the project that contains the custom activity and verify that the following line is there:

    [assembly: XmlnsDefinition("wf://workflow.windows.net/$Current/$Activities", "YourProjectNamespace")]


    The second parameter must match the namespace of the project that contains the custom activities. If this line is not present, add it, and add a using System.Windows.Markup; at the top of the file. Build the custom activity project again, and then delete and re-add the activity into the workflow.

    Once the activity is a re-added to the workflow, open the Xaml (right click the activity in Solution Explorer and choose Open With, XML (Text) Editor, click OK, and verify that the following line is present.

    xmlns:p1="wf://workflow.windows.net/$Current/$Activities"

    If you didn't have both of these things before, then adding them should resolve the "Cannot create unknown type" exception.

    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

    [Edit] If it is a custom code activity then you also need to follow the steps linked in the previous post, to add the types to the allowable types list (or for a dev box to disable the whitelist): http://msdn.microsoft.com/en-us/library/windowsazure/jj193517(v=azure.10).aspx and http://msdn.microsoft.com/en-us/library/windowsazure/jj193517(v=azure.10).aspx#BKMK_DisableDefaultProtection


    quarta-feira, 8 de maio de 2013 18:31
  • I am having this exact issue trying to deploy my workflow which has a custom code activity to SharePoint 2013 farm. I have updated the assembly.cs file and also see the xmlns:p1 entry in my workflow's xaml file. I have made sure to copy the dll in the correct directories, disabled the white list, and restarted the workflow service, etc.

    The strange thing is that I can use my custom code activity in SPD created workflows fine. But not from VS2012. Any hints as to what I may be doing wrong?

    Thanks.

    sexta-feira, 6 de setembro de 2013 19:03
  • I have a workflow which is a XAML file and then I have a code activity class which is a custom code activity. I have built and used the same within the XAML file 

    I have followed the steps to publish a code activity. 

    However, I'm getting error

    Setting up scope...[Done]
    Publishing Workflow...Workflow XAML failed validation due to the following error
    s:
    Invalid type(s) 'HelloWorldWorkFlow.HelloWorldCodeActivity'.
     HTTP headers received from the server - ActivityId: 59136bdf-9b97-4dc5-bd08-c15
    ca26b4cbc. NodeId: [ServerName]. Scope: /HelloWorldWF. Client ActivityId : 909f2fb
    9-112f-481b-b6a0-1580710961ee.
    *******************
    System.Net.WebException: The remote server returned an error: (400) Bad Request.

       at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult resul
    t)
       at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.End(IAsyncResult re
    sult)
       at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest requ
    est, T content)
    Press any key to exit.


    Any help would be appreciated. Not sure if this piece at all works or not.



    Thanks & Regards, Soumyadev | Posting is provided "AS IS" with no warranties, and confers no rights.

    quinta-feira, 13 de março de 2014 20:47
  • I have managed to resolve this issue. The trick is to copy the custom DLL to GAC as well and then restart the Windows Workflow manager background service.

    Radhakrishna

    • Sugerido como Resposta Soumyadev quinta-feira, 27 de março de 2014 03:56
    segunda-feira, 17 de março de 2014 22:46
  • Hi

    We had to update following in assemblyinfo.cs file.

    assembly: XmlnsDefinition("wf://workflow.windows.net/$Current/$Activities", "YourProjectNamespace")]

    to 

    assembly: XmlnsDefinition("wf://{WorkflowManagerServerName}:12291/$Current/$Activities", "YourProjectNamespace")]

    for e.g.

    assembly: XmlnsDefinition("wf://workflowmanagerserver:12291/$Current/$Activities", "YourProjectNamespace")]

    Only then custom code activity started working. However, this means, when we want to deploy in other environment with different URL, we need to re-build the assembly. 

    Is there any way by which we have this configurable?

    Regards,

    RK


    Radhakrishna

    quinta-feira, 20 de março de 2014 19:11
  • Hi 

    Found an alternative, instead of hardcoding URL of the server where Workflow Manager is installed, you can specify the namespace. The namespace can be retrieved using Get-SBNamespace command in powershell console of either workflow manager or service bus. However, this means that Namespace should be same in all environments. 

    Regards,

    RK


    Radhakrishna

    • Sugerido como Resposta Soumyadev quinta-feira, 27 de março de 2014 03:56
    sábado, 22 de março de 2014 18:51