none
SP Designer 2013 - Workflow internal server error when publishing

    Question

  • Hi, 

    I'm having problem recently when trying to publish a workflow from SPD2013. It shows:

    "Errors were found when compiling the workflow. The workflow files were saved but can not be run" and there's the detail below it:

    System.InvalidOperationException: 
    Operation failed with error Microsoft.Workflow.Client.InternalServerException: 
    An internal error occured. For more details, please see the server logs. 
    Client ActivityId : 
    10e81d9c-2678-c09c-85e2-edf4fba12a43. ---> System.Net.WebException: 
    
    The remote server returned an error: (500) Internal Server Error.
    at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
    at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.End(IAsyncResu


    I used to publish workflows from SPD2013 normally, this just happen after I restarted the server until now.

    Any clue around this error? Kindly help me please... :)

    Thanks...

    Note, here's the log from ULS:

    05/23/2013 08:56:51.32 	w3wp.exe (0x2328)                       	0x2044	SharePoint Server             	
    Workflow Services             	ajre7	Exception	 Microsoft.Workflow.Client.InternalServerException: An internal error occured. For more details, please see the server logs. Client ActivityId : 2e221e9c-a685-c09c-85e2-e2894f039829. ---> System.Net.WebException: 
    The remote server returned an error: (500) Internal Server Error.     
    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)     --- End of inner exception stack trace ---     
    at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)     
    at Microsoft.Workflow.Client.WorkflowManagementClient.SendRequest[T](HttpWebRequest request, T content)  ...	2e221e9c-a685-c09c-85e2-e2894f039829

    I've checked again to the Workflow events, and it looks like caused by some keyset does not exist... I've read sometimes ago about this, but forgot where it is. Maybe anyone notice about this?

    Error processing management request. Method: PUT, RequestUri: http://sharepoint2013:12291/SharePoint/default/9d640f51-b709-48a0-bc86-8674e4699f34/e1b2c1e3-22d7-4208-a344-652c39ed21c5/$Activities/WorkflowXaml_8091d957_2002_4fdf_8923_76972094f689?$overwriteXClass=true, 
    
    Error: System.Security.Cryptography.CryptographicException: Keyset does not exist
    
       at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
       at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
       at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
       at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()
       at Microsoft.Workflow.Common.EncryptionHelper.DecryptStringWithCertificate(X509Certificate2 encryptionCertificate, String encryptedText)
       at Microsoft.Workflow.Management.WorkflowEncryptionSettings.InitializeInternal()
       at Microsoft.Workflow.Management.WorkflowServiceConfiguration.get_EncryptionSettings()
       at Microsoft.Workflow.Management.WorkflowServiceConfiguration.GetResourceManagementConnectionStringFromConfig()
       at Microsoft.Workflow.Management.WorkflowServiceConfiguration.get_ConfigProvider()
       at Microsoft.Workflow.Management.WorkflowServiceConfiguration.GetWorkflowServiceConfiguration()
       at Microsoft.Workflow.Gateway.HttpConfigurationInitializer.CreateServiceContext(String nodeId, NamespaceSender namespaceSender)
       at Microsoft.Workflow.Gateway.HttpConfigurationInitializer.EnsureInitialized(String nodeId, NamespaceSender namespaceSender)
       at Microsoft.Workflow.Gateway.HttpConfigurationInitializer.Initialize(HttpConfiguration config, String nodeId, NamespaceSender namespaceSender)
       at Microsoft.Workflow.Gateway.Global.EnsureConfigInitialized(String nodeId)
       at Microsoft.Workflow.Gateway.Global.Application_BeginRequest(Object sender, EventArgs e)


    • Edited by DandiGi Thursday, May 23, 2013 6:49 AM KEYSET DOES NOT EXIST?
    Thursday, May 23, 2013 5:06 AM

Answers

  • Hi,

    Finally, I found the solution. 

    Solution: Grant permission of workflow manager service account in "WF_InstanceManagement_DB" and "WF_ResourceManagement_DB".

    I found below error message in event viewer (under Applications and Services Log\Microsoft-Workflow\Operational).

    Failed SQL command after 1 tries with error '229'. Exception: System.Data.SqlClient.SqlException (0x80131904): The EXECUTE permission was denied on the object 'InsertTrackingAndStatus', database 'WF_InstanceManagement_DB', schema 'dbo'.

       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

       at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader()

       at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)

       at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)

       at Microsoft.Workflow.Management.ExecuteNonQueryAsyncResult.OnEndExecuteSql(IAsyncResult result)

       at Microsoft.Workflow.Management.ExecuteSqlAsyncResult.EndAsyncResult(IAsyncResult result)

       at Microsoft.Workflow.Common.BackoffRetryAsyncResult.IsolateWithRetry(IAsyncResult result)

       at Microsoft.Workflow.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)

    ClientConnectionId:1aca77c8-ffa5-4ef8-8637-d32a98b66395  Command Details:   SQL Text          : InsertTrackingAndStatus

      SQL Parameters    :

        > @StatusRecords = Microsoft.Workflow.Management.SqlDataAccessProvider+InstanceStatusValuesCollection

        > @MetadataWithInstanceId =

        > @Variables = Microsoft.Workflow.Management.SqlDataAccessProvider+VariablesCollection

        > @TrackingRecords =

        > @StatusHistoryRecords =

        > @DebugTraceRecords =

        > @RollingStatusHistoryWindowSize = 1000

        > @RollingDebugTraceWindowSize = 5000

    Hope it will help you.


    kmhsad


    Wednesday, May 29, 2013 2:49 AM

All replies

  • Hi,

    I am not sure why it is happening, but you can take a look at this article:

    Troubleshooting Workflow Manager 1.0 Management and Execution

    Probably it helps you to identify what part is misbehaving.

    Also you can try to re-register workflow service. As I understand you use HTTP (not HTTPS), so your PowerShell cmdlet could look something like that:

    Register-SPWorkflowService -SPSite 'http://myhost/mysite' -WorkflowHostUri 'http://workflowhost:12291' -AllowOAuthHttp -Force

    ____________________________________________

    Regards Michael (http://sp2013-blog.com)
    Please, don't forget to press upvote (if answer is helpful) and mark as answer (if it solves your issue)


    • Edited by MikhailSP Thursday, May 23, 2013 8:56 AM
    Thursday, May 23, 2013 8:55 AM
  • Hi,

    After i re-register the workflow service, i am able to publish the workflow from designer. But when i click on workflow action of the item (_layouts/15/Workflow.aspx), i am getting below same error message. 

    System.Net.WebException: The remote server returned an error: (500) Internal Server Error.    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) 28751f9c-2315-c0a5-a160-fd7c528b0eb2

    Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.Workflow.Client.InternalServerException: Exception thrown from the data layer. For more details, please see the server logs. HTTP headers received from the server - ActivityId: ec96d6ed-223e-4bed-be5a-dc590e8d82b0. NodeId: SP2013. Scope: /SharePoint/default/8bfae93a-662a-4173-a6bb-8a5d35af3d69/ce115d0f-31a8-4b0f-a5ea-9b86b263da08. Client ActivityId : 28751f9c-2315-c0a5-a160-fd7c528b0eb2. ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.     at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)     at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.En... 28751f9c-2315-c0a5-a160-fd7c528b0eb2
    ...d(IAsyncResult result)     at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)     --- End of inner exception stack trace ---     at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)     at Microsoft.Workflow.Client.InstanceManager.GetInternal(Int32 skip, Int32 count, String workflowName, WorkflowInstanceStatus workflowStatus, IDictionary`2 activationMetadataFilter)     at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateByMonitoringParameter(Guid monitoringParameter, Int32 offset, Int32 count, Boolean checkPermissions)     at Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateInstancesForListItem(Guid listId, Int32 itemId, Int32 offset)     at Microsoft.... 28751f9c-2315-c0a5-a160-fd7c528b0eb2
    ...SharePoint.WorkflowServices.FabricWorkflowInstanceProvider.EnumerateInstancesForListItem(Guid listId, Int32 itemId)     at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPageBase.ConstructStatusArraysWF4(ArrayList running, ArrayList completed, Boolean onlyMyWorkflows)     at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.ConstructStatusArrays()     at Microsoft.SharePoint.WorkflowServices.ApplicationPages.WorkflowPage.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStag... 28751f9c-2315-c0a5-a160-fd7c528b0eb2
    ...esAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

    Any idea ?


    kmhsad

    Monday, May 27, 2013 8:46 AM
  • Hi,

    Finally, I found the solution. 

    Solution: Grant permission of workflow manager service account in "WF_InstanceManagement_DB" and "WF_ResourceManagement_DB".

    I found below error message in event viewer (under Applications and Services Log\Microsoft-Workflow\Operational).

    Failed SQL command after 1 tries with error '229'. Exception: System.Data.SqlClient.SqlException (0x80131904): The EXECUTE permission was denied on the object 'InsertTrackingAndStatus', database 'WF_InstanceManagement_DB', schema 'dbo'.

       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

       at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader()

       at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)

       at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)

       at Microsoft.Workflow.Management.ExecuteNonQueryAsyncResult.OnEndExecuteSql(IAsyncResult result)

       at Microsoft.Workflow.Management.ExecuteSqlAsyncResult.EndAsyncResult(IAsyncResult result)

       at Microsoft.Workflow.Common.BackoffRetryAsyncResult.IsolateWithRetry(IAsyncResult result)

       at Microsoft.Workflow.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)

    ClientConnectionId:1aca77c8-ffa5-4ef8-8637-d32a98b66395  Command Details:   SQL Text          : InsertTrackingAndStatus

      SQL Parameters    :

        > @StatusRecords = Microsoft.Workflow.Management.SqlDataAccessProvider+InstanceStatusValuesCollection

        > @MetadataWithInstanceId =

        > @Variables = Microsoft.Workflow.Management.SqlDataAccessProvider+VariablesCollection

        > @TrackingRecords =

        > @StatusHistoryRecords =

        > @DebugTraceRecords =

        > @RollingStatusHistoryWindowSize = 1000

        > @RollingDebugTraceWindowSize = 5000

    Hope it will help you.


    kmhsad


    Wednesday, May 29, 2013 2:49 AM
  • This worked for me too, thanks!
    Friday, June 14, 2013 3:19 AM
  • Thanks for the help. 

    You can grant your Workflow Service account SysAdmin rights in SQL to get this working too. 

    See http://technet.microsoft.com/en-us/library/jj193451.aspx

    The user must have SysAdmin privilege on this SQL Server instance, otherwise, the databases should be pre-created and the Sql logon for the RunAs Account User should be created manually, before running the configuration, on all Sql instances.

    Thanks

    Matt


    Matt Engibous

    Thursday, December 04, 2014 11:07 PM
  • kmshad's solution worked for me too but I thought I'd make it very specific for those who need to be running a least privileges environment.

    I was able to get this running by just giving the WF service account execute rights on that one stored procedure... Doing it this way is a lot more secure.

    use [WF_InstanceManagementDB]
    GO
    GRANT EXECUTE ON [dbo].[GetInstances] TO [DOMAIN\Svc-Workflow]
    GO

    Tuesday, May 26, 2015 9:28 PM