代码之家  ›  专栏  ›  技术社区  ›  Ehsan Akbar

服务器“”上的MSDTC不可用。调用存储过程时发生sql server链接服务器错误

  •  0
  • Ehsan Akbar  · 技术社区  · 7 年前

    ServiceServer DatabaseServer WarehouseServer

    调用中的存储过程 数据库服务器 .

    public async void UpdateStatus(NajaResult najaresult, string userid, string IsWorn, string FuelSystem, string ValidTest, string SymfaServiceStatus, string NajaServiceStatus)
    {
        string _FuelSystem = (string.IsNullOrEmpty(FuelSystem)) ? "2" : FuelSystem;
        _ctx.Database.ExecuteSqlCommand("EXEC [dbo].[UpdateInquiryStatus] @userid='" + userid + "', @IsWorn='" + IsWorn + "',@FuelSystem='" + _FuelSystem + "',@ValidTest='" + ValidTest + "',@SymfaServiceStatus='" + SymfaServiceStatus + "',@NajaServiceStatus='" + NajaServiceStatus + "' ,"
    + "@Chassis='" + najaresult.Chassis + "',@CarColor=N'" + najaresult.CarColor + "',@MotorNum='" + najaresult.MotorNum + "' ,@Vin='" + najaresult.VinNo + "', @SystemType=N'" + najaresult.SystemType + "',@CarTipe=N'" + najaresult.CarTip + "',@FuelType='" + najaresult.FuelType + "',@Model='" + najaresult.CarModel + "'" + ",@CarType=N'" + najaresult.CarType + "'");
    }
    

    这是我的存储过程 UpdateInquiryStatus 数据库服务器 :

    ALTER PROCEDURE [dbo].[UpdateInquiryStatus]
        @userid nvarchar(max),
        @IsWorn nvarchar(max),
        @FuelSystem nvarchar(max),
        @ValidTest nvarchar(max),
        @SymfaServiceStatus nvarchar(max),
        @NajaServiceStatus nvarchar(max),
        @Vin nvarchar(max),
        @SystemType nvarchar(max),
        @CarTipe nvarchar(max),
        @FuelType nvarchar(max),
        @Model nvarchar(max),
        @Chassis nvarchar(max),
        @CarColor nvarchar(max),
        @MotorNum nvarchar(max),
        @CarType nvarchar(max)
    AS   
        INSERT INTO [PRISYMFA22a1\MASSYMSQLSERVER].[DB].[dbo].AutomotiveTemps 
               (id, isworn, validtest, CarColor, CarTipe, CarType, Chassis, 
                FuelSystem, FuelType, Model, MotorNum, SubmitDatetime, 
                SystemType, UserId, VIN)
        VALUES (NEWID(), @IsWorn, @ValidTest, @CarColor, @CarTipe, @CarType, @Chassis,
                @FuelSystem, @FuelType, @Model, @MotorNum, GETDATE(),
                @SystemType, @userid, @Vin)
    

    作为说明,我在 仓库服务器 .

    如您所见,我的过程将记录插入到 仓库服务器 但我得到了这个错误:

    服务器“DatabaseServer”上的MSDTC不可用。

    但我的msdtc正在运行,所有防火墙都已禁用。我也在组件服务中打开了所有入站和出站远程。但返回了相同的错误

    1 回复  |  直到 7 年前
        1
  •  0
  •   spodger    7 年前

    转到DatabaseServer上的组件服务,向下导航到本地DTC,右键单击并选择属性。

    在“安全”选项卡上,确保已检查网络DTC访问并允许远程客户端。

    选中Transaction Manager Communication(事务管理器通信)下的Allow Inbound(也可能Outbound),您可能需要根据在DatabaseServer和ServiceServer上运行的Windows版本更改身份验证。

    推荐文章