ssis 找不到端点元素

ssis could not find endpoint element

我正在 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(Solution Users Option)文件,这样它可以为 XMLEditor 重置 cashe,但它没有用。

这是我的版本:

Microsoft Visual Studio Professional 2015 版本 14.0.25431.01 更新 3

Microsoft .NET 框架版本 4.7.02556

.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);

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