January 9, 2013 at 2:34 PM
Today I've encountered a problem with the party configuration, specifically while reconfiguring send ports from a party. An error occurred when I removed a send port from a party and saved my settings.
The error
The error occurred during the removing of a send port from a party: Sendport Reference [Microsoft.BizTalk.B2B.PartnerManagement.SendPortReference] cannot be deleted as it is use by agreement [Microsoft.BizTalk.B2B.PartnerManagement.SendPortReference]. (Microsoft.BizTalk.B2B.PartnerManagement)

The troubleshooting
Based on a forum thread on MSDN, this seems to be a bug in the BizTalk console, but has never been officially announced or patched. The forum thread suggests waiting for the next cumulative update for BizTalk server [link: cumulative updates Biztalk]. But even when I applied an update for BizTalk to the next version, the problem didn't got solved.
Based on the error message, a constraint prohibits removing the send port record assigned to this party. The OnewayAgreementSendPortReference table contains all send port records for each party. A foreign key is present between OnewayAgreementSendPortReference.SendPortReferenceId and the SendPortReference.Id colomn.
The solution
I had to manually remove the Foreign key record from the SendPortReference table.
Connect to the BizTalk SQL database instance of the BizTalkMgmtDb catalog.
Change the @Name variable to the name of the send port you would like to remove from the party.
DECLARE @NAME varchar(100)
SET @NAME = 'spo_3025816970108_3014683300200_INVRPT_EDI_FTP_PRD'
DECLARE @ID int
SELECT @ID = id
FROM [BizTalkMgmtDb].[tpm].[SendPortReference]
WHERE Name = @NAME
DELETE FROM [BizTalkMgmtDb].[tpm].[OnewayAgreementSendPortReference]
WHERE SendPortReferenceId = @ID
DELETE FROM [BizTalkMgmtDb].[tpm].[SendPortReference]
WHERE Name = @NAME
After running this query, refresh your BizTalk administration console and the send port is now removed from the party.
Important note:
Be aware that fiddling with the BizTalk internal databases is not a recommended approach and is not supported by Microsoft.
Any support case dealing with issues after manually changing the BizTalk internal databases will have to be paid fully or result in a re-installation!
f2586387-1862-4970-9b15-2924980161cf|2|5.0