Search API License is not Properly Applied in C#

I’m testing GroupDocs Search using the temporary license in my .Net application. I have sporadic success and then I get the " Object reference not set to an instance of an object. error that occurs for a period of time and then the search functions successfully. I’m very frustrated with this because the search is excellent when it works successfully.

Here’s the code I’m using to call the license. It succeeds and fails on this line:

lic.SetLicense(Server.MapPath("~/bin/GroupDocs.Search.NET.lic"));

Is this happening because I’m using a temporary license?

@mdennis5023

No, a temporary license is just like a full license with just the time limitation. Could you please share the license file in a private message? Are you using any other GroupDocs or Aspose APIs in the same application? If yes, please share their versions.

I don’t know how to send you the file in a private message, but the error didn’t occur all night but now this morning I get it again. I’m curious, are you load balanced and is there a chance that one of your servers is acting up?

Now I’m getting the second error message that the license is not valid.

And now, inexplicably, the link to the license is successful again.

@mdennis5023

Please apply license only in Global.asax.cs.

protected void Application_Start()
{
       License license = new License();
       license.SetLicense("license path");
}

If issue persists, please share the sample application/project using that we could reproduce the issue at our end.

Ok, I’ll try that.

@mdennis5023

Alright.

Atir, everything has been working very well since I added the code to the global.ascx file. No errors so far.

Thank you very much for your help.

Mike

1 Like

@mdennis5023

You are welcome.

When will it be supported for Dotnet core 6?

1 Like

@Shahkarhassan

We answered this query here.