Splunk Dev

C# SDK LogOnAsyc fail!!

sspeng1209
New Member

When I use c# 2.0 SDK calll service.LogOnAsync function, I receive the following message:
Message: The underlying connection was closed: The connection was closed unexpectedly.

How to solve it?

Code:
static async Task async1()
{
try
{
// Create a Service instance
var service = new Service(new Uri("http://localhost:8089"));
await service.LogOnAsync("admin", "test1234");
........................
}
catch(Exception err)
{
Console.WriteLine("Message=",err.Message);
}
}

    static void Main(string[] args)
    {           
        Task.Run(()=> async1());
        Console.ReadKey();            
    }
Tags (2)
0 Karma

jkat54
SplunkTrust
SplunkTrust

You should be using https://localhost:8089 not http

This is the Splunk Daemons rest API port and it’s SSL by default (https).

0 Karma

sspeng1209
New Member

I try it using https://localhost:8089.But i receive the message:
The underlying connection is down: A trust relationship cannot be established for the SSL/TLS secure channel.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...