Hi @Harun Kara ,
This may be because the workflow is working on an item, and the priority of the running state is higher than the priority of stopping the workflow. Therefore, you cannot enforce stop the workflow.
To fix this issue, please remove the scope which holds that workflow.
- Remove the scope from the dbo.Scopes table of the WFResourceManagementDB Database
- Restart ServiceBus Gateway and Broker services
- Create scope programmatically.
- Publish workflow again
Note: This will cause all running instances of the workflow to fail!
Thanks,
Echo Du
---------------------------------
Updated Answer -------------------------------------
Hi @Harun Kara ,
Before removing the workflow scopes, you should back it up.
Here is the PowerShell script to backup Database from SQL Server:
#Import SQL PowerShell module
Import-Module SQLPS –DisableNameChecking
#Configuration parameters
$SQLInstance="Cre-SQL-001"
$BackupPath="D:\Backup\"
#Array of Database names, Comma separated
$DBName="WFResourceManagementDB"
#Backup Database
Write-host "Backing up the database: $($DBName)"
Backup-SqlDatabase -ServerInstance $SQLInstance -Database $DBName -BackupFile "$($BackupPath)\$($DBName).bak"
Use the "Restore-WFScope" cmdlet to restore a previously backed-up Workflows scope.
Syntax:
Parameter Set: Default
Restore-WFScope -BackupInstanceDBConnectionString <String> -BackupResourceDBConnectionString <String> -BackupSBGatewayDBConnectionString <String> -BackupSBMessageContainerConnectionString <String[]> -InstanceStateSyncTime <DateTime> -LiveInstanceDBConnectionString <String> -LiveResourceDBConnectionString <String> -ScopePath <String> [-AbortOnError] [-LiveSiteEncryptedEncryptionToken <String> ] [-LiveSiteEncryptionCertificate <X509Certificate2> ] [-LiveSiteEncryptionToken <String> ] [ <CommonParameters>]
Run Restore-WFScope to restore a previously backed-up Workflows scope. It provides the ability to help customers recover from unexpected deletions of scopes that need recovery using a backup.
- More information, please refer to Restore-WFScope .
Thanks,
Echo Du
===========
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.