I'm developing a .NET application that needs to use the K2 Management API. I started by making a new console application just to test out the API and make sure I can get all of the information and perform all of the actions that I need. I was able to successfully connect to the K2 server and query user permissions, process instances, and worklist items with the console application.
However, as soon as I created a new MVC application and copied all of my example code over, I started receiving ArgumentExceptions with a "Claims token XML is empty" message when trying to open the connection.
I have tried using both the current Windows Identity for authentication (which is my end goal), as well as using hard-coded user authentication. Both ways work perfectly fine when connecting from a console application, but both return the same "Claims token XML is empty" message when connecting from a web application.
Here's what I'm doing to connect:
var builder = new SCConnectionStringBuilder
{
Integrated = true,
IsPrimaryLogin = true,
Authenticate = true,
EncryptedPassword = false,
Host = "k2dev.example.com",
Port = 5555,
SecurityLabelName = "K2"
};
var manager = new WorkflowManagementServer();
manager.Open(builder.ConnectionString);
Again, this works perfectly fine from my console application, but an exception is thrown on the "manager.Open()" call from my MVC application. Both are .NET 4.6, both are compiling for AnyCPU.
Any suggestions would be appreciated. Thanks.