【问题标题】:ssis could not find endpoint elementssis 找不到端点元素
【发布时间】:2020-10-14 17:51:31
【问题描述】:

我正在 SSIS 脚本任务中创建 SSIS 包和编码。在我的代码中,我正在连接到第三方服务,但由于以下错误而无法连接

所以我检查了我的 app.config 文件并看到了蓝色波浪线,但我不知道它为什么在那里。这是我的 app.config 文件

我删除了合约并开始输入,我发现该服务没有在合约属性中列出。

这是我的代码文件

        namespace ST_5fbd7f2f2bb84852b98e39162197f9df
     {
    using System;
     using System.Collections.Generic;
     using System.Linq;
     using System.ServiceModel;
     using System.ServiceModel.Channels;
     using System.Text;
     using LoginServiceReference;
 [Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
     public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
     {
 public void Main()
         {
             // TODO: Add your code here
         LoginServiceClient loginClient = null;
             try
             {
                 // Setup your user credentials.
                 string Message = "";
                 string AuthenticationToken = "";
                 string UserName = "";
                 string Password = "";
                 string UserAPIkey = "";
                 string CustomerAPIkey = "";
                 int TotalPages = 0;
                 // Create a proxy to the login service.
                 loginClient = new LoginServiceClient("WSHttpBinding_ILoginService");
    
                 // Submit the login request to authenticate the user.
                 AuthenticationStatus loginRequest = loginClient.Authenticate
                     (CustomerAPIkey, Password, UserAPIkey, UserName, out Message, out AuthenticationToken);
    
                 if (loginRequest == AuthenticationStatus.Ok)
                 {
                     MessageBox.Show("User authentication successful.");
                 }
                 else
                 {
                 MessageBox.Show("User authentication failed: " + Message.ToString());
                 }
                 Dts.TaskResult = (int)ScriptResults.Success;
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Exception: " + ex.ToString());
                 Dts.TaskResult = (int)ScriptResults.Failure;
             }            }    }
    }

如果您能在这方面提供帮助,我将不胜感激。

这是我所做的。

我尝试在关闭 VS 后删除 .SUO(解决方案用户选项)文件,这样它可以重置 XMLEditor 的 Cashe,但它不起作用。

这是我的版本:

Microsoft Visual Studio Professional 2015 版本 14.0.25431.01 更新 3

Microsoft .NET Framework 版本 4.7.02556

【问题讨论】:

    标签: ssis


    【解决方案1】:

    .NET 在加载配置数据时查找的配置文件是实际运行的可执行文件的配置文件。 SSIS 不会使用该 app.config。请参阅:SSIS With Script Component and Service References 提供了更多详细信息。

    我们将 Ultipro 的报告用作服务并遇到了同样的问题。所以在代码中你必须创建绑定和端点并忽略 app.config。

    添加:

    using System.ServiceModel;
    

    更新您的代码,创建绑定和端点并将它们传递给 LoginServiceClient:

            var binding = new WSHttpBinding();
            binding.Security.Mode = SecurityMode.Transport;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
    
            EndpointAddress loginEndPoint = new EndpointAddress("https://service5.ultipro.com/services/LoginService");
    
            loginClient = new LoginServiceClient(binding,loginEndPoint);
    

    我们将端点地址存储在项目配置中,并将其与凭据一起传递到脚本中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-30
      • 2010-09-26
      • 2018-02-15
      • 1970-01-01
      • 2012-04-25
      • 1970-01-01
      • 2015-11-02
      • 1970-01-01
      相关资源
      最近更新 更多