user2057148
user2057148

Reputation: 25

ssis could not find endpoint element

I am creating SSIS package and coding in SSIS Script Task. In my code I am connecting to thirdparty service and not able to connect due to the error below

enter image description here

So I checked my app.config file and saw the blue squigly line, I dont why it is there. Here is my app.config file

enter image description here

The I deleted the contract and start typing, I found that the service is not listed in the contract attribute.

enter image description here

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.

Here is my version:

Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3

Microsoft .NET Framework Version 4.7.02556

Upvotes: 1

Views: 551

Answers (1)

Tim Mylott
Tim Mylott

Reputation: 2723

The configuration file that .NET looks for when it loads configuration data is the one for the executable that's actually running. SSIS will not use that app.config. See: SSIS With Script Component and Service References gives a little bit more details.

We use Ultipro's reports as a service and ran into the same issue. So in code you have to create the bindings and endpoints and ignore the app.config.

Add:

using System.ServiceModel;

Update your code, create a binding and endpoint and pass those to 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.

Upvotes: 2

Related Questions