BizTalk Management and MessageBox Databases Sync Issue – Part2- UN-Deployment

Second phase of BizTalk Management and MessageBox DB sync issue is Un-Deploying/Deleting application. Fortunately issue was with only 2 applications.

When tried to Delete (either from Cosnole Or BTSTask -Remove App command ) an application in order to deploy a new version,we got an error popping out every-time saying

The service action could not be performed because the service is not registered

The application was visible in the BizTalk Admin Console.

Funny part was; application was running without any issue and all messages subscribed by artifacts of this application were being processed successfully.

This helped me in buying some time to dig out the issue.

From previous experience it was evident that something was missing in the BizTalk Databases and most likely in the BizTalkMsgBoxDb and analyzing further with help of SQL-Profiler and BizTalk Trace we were able to find that Port information was not present in Service table and Application name as not registered in Module table.


Take backup of BizTalk Databases (we can rely on SQL jobs for BizTalk DBs 🙂 )

Stop all hosts instances.

Check application artifacts in following tables.   bts_application, bts_receiveport, and bts_sendport and bts_assembly tables in the BizTalkMgmtDb. (If you have other artifact in your application, then you need to check in respective table e.g. Send Port Group, Orchestration etc.

Insert Application Name in Module tables which will (auto)generated Module Id. Use this Id ‘nModuleID’ in service tablle

Insert into [BizTalkMsgBoxDb].[dbo].[Modules] ([nvcName],[dtTimeStamp])
values ('Application.MyApplication', GETDATE())

Find Service Instance IDs (uidGUID) in bts_SendPorts, bts_ReceievPorts i.e. (all possible artifacts tables).

SELECT uidGUID FROM [BizTalkMgmtDb].[dbo].[bts_receiveport] WITH (NOLOCK)
WHERE nvcName =<'your artefact name'>

SELECT uidGUID FROM [BizTalkMgmtDb].[dbo].[bts_sendport] WITH (NOLOCK)
WHERE nvcName =<'your artefact name'>

Then insert Service Instance ID (uidGUID) in Services table with Module ID for all artifacts One by One

I had 2 Receive Ports and 2 Send Ports which led me to make 4 entries in Services table.

Get ModuleID from Modules table for respective application and use in below query

Insert INTO[BizTalkMsgBoxDb].[dbo].[Services]


VALUES ('<ServiceIntanceID from artifact table>',Null,<ModuleID>,0)


Un-Deploy Or Re-Deploy Happily.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: