簡體   English   中英

鏈接服務器:“沒有事務處於活動狀態。”和“無法開始分布式事務”

[英]linked server : “No transaction is active.” and “unable to begin a distributed transaction”

我的本地計算機上有一個CRM軟件。 在該軟件的SQL DB中,我添加了一個鏈接服務器(帶有測試數據庫的測試網站:Windows Small Business Server 2011)。 鏈接服務器設置為

RPC => True
RPC Out => True
Enable Promotion of Distributed Transaction => True

我創建了一個觸發器,以便在通過CRM軟件更新公司時,它會啟動一個存儲過程,例如:

proc [dbo].[Proc_UpdateInstitutionWeb]
@Company_ID nvarchar(50)

as

DECLARE @id int = 0;

BEGIN TRY
    SET @id = CONVERT(int, @Company_ID)
END TRY
BEGIN CATCH
    ...
END CATCH

update [myserver].[mydatabase].[dbo].[company] 
set founded = 2000
where company.id= @id

當我在CRM中進行更改時,這不起作用。 因此,我在CRM SQL DB中的company表上嘗試了一個簡單的更新查詢,但它引發以下錯誤:

OLE DB provider "SQLNCLI10" for linked server "myserver" returned message "No transaction is active.". Msg 7391, Level 16, State 2, Procedure Proc_UpdateInstitutionWeb, Line 34 The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "myserver" was unable to begin a distributed transaction.

這是我嘗試做的事情:

在我的計算機和測試服務器上:

  • 在管理工具->服務->分布式事務處理協調器中:啟動服務
  • 在管理工具->組件服務->計算機->我的電腦->分布式事務處理協調器->本地DTC->右鍵單擊->安全選項卡->選中網絡DTC訪問並允許遠程客戶端,並允許入站和出站。
  • 最后我重新啟動了測試服務器

這些都沒有解決問題。 我該怎么辦?

謝謝

經過數天的脫發,如果有人需要,這對我有用。

首先,我禁用了自動6to4地址生成功能。

 1. Open Command
 2. Type the command `netsh interface 6to4 set state disabled`

然后我限制了兩台機器上的DCOM端口范圍

 1. Start -> Run -> Type DCOMCNFG
 2. Go to the properties of the My Computer node under the Computers folder underneath Component Services. 
 3. Under the My Computer Properties look under the Default Protocols tab. 
 4. Over there make sure that Connection-oriented TCP/IP is selected and then click on Properties. 
 5. No range was listed. I added one. Example 5000-5100

我認為Component servicesServices有關DTC的所有先前工作也都需要進行這項工作。

我最終得到了與DTCPing.exe和以下參考一起使用的解決方案:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM