Here is the code for my Windows Form. I used the same info on the example application generated from the Splunk Template and it worked. I have tried several different ways to get this working and this is about as simple as I can get it and still no error and no response.
using System;
using System.Threading.Tasks;
using System.Windows.Forms;
using Splunk.Client;
using System.Net;
namespace AI.Splunk.WinFormApp
{
public partial class Form1 : Form
{
private const string SplunkServerName = "servername";
private const int SplunkServerPort = 8089;
private const string SplunkUserName = "username";
private const string SplunkPassword = "password";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
BasicTest().Wait();
}
private async Task BasicTest()
{
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =>
{
return true;
};
var service = new Service(Scheme.Https, SplunkServerName, SplunkServerPort);
try
{
await service.LogOnAsync(SplunkUserName, SplunkPassword);
}
catch(Exception ex)
{
richTextBox1.Text = ex.ToString();
}
richTextBox1.Text = "Done";
}
}
}
... View more