简体   繁体   English

ssis 找不到端点元素

[英]ssis could not find endpoint element

I am creating SSIS package and coding in SSIS Script Task.我正在 SSIS 脚本任务中创建 SSIS 包和编码。 In my code I am connecting to thirdparty service and not able to connect due to the error below在我的代码中,我连接到第三方服务,但由于以下错误而无法连接

在此处输入图片说明

So I checked my app.config file and saw the blue squigly line, I dont why it is there.所以我检查了我的 app.config 文件并看到了蓝色的波浪线,我不知道它为什么在那里。 Here is my app.config file这是我的 app.config 文件

在此处输入图片说明

The I deleted the contract and start typing, I found that the service is not listed in the contract attribute.我删除了合约并开始输入,我发现合约属性中没有列出该服务。

在此处输入图片说明

Here is my code file这是我的代码文件

        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;
             }            }    }
    }

I would appreciate if you can help in this.如果您能在这方面提供帮助,我将不胜感激。

Here is what I have done.这是我所做的。

I tried deleting .SUO (Solution Users Option) file after closing VS, so it can reset cashe for XMLEditor but it did not work.我尝试在关闭 VS 后删除 .SUO(解决方案用户选项)文件,因此它可以为 XMLEditor 重置 cashe,但它不起作用。

Here is my version:这是我的版本:

Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3 Microsoft Visual Studio Professional 2015 版本 14.0.25431.01 更新 3

Microsoft .NET Framework Version 4.7.02556 Microsoft .NET 框架版本 4.7.02556

The configuration file that .NET looks for when it loads configuration data is the one for the executable that's actually running. .NET 在加载配置数据时查找的配置文件是实际运行的可执行文件的配置文件。 SSIS will not use that app.config. SSIS 不会使用那个 app.config。 See: SSIS With Script Component and Service References gives a little bit more details.请参阅:带有脚本组件和服务引用的 SSIS提供了更多详细信息。

We use Ultipro's reports as a service and ran into the same issue.我们将 Ultipro 的报告用作服务并遇到了同样的问题。 So in code you have to create the bindings and endpoints and ignore the app.config.所以在代码中你必须创建绑定和端点并忽略 app.config。

Add:添加:

using System.ServiceModel;

Update your code, create a binding and endpoint and pass those to LoginServiceClient:更新您的代码,创建绑定和端点并将它们传递给 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);

We store the endpoint address in project configurations and pass that into the script along with the credentials.我们将端点地址存储在项目配置中,并将其与凭据一起传递到脚本中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM