Closed ryjel closed 7 years ago
This is happening for me as well.
More specifically, I'm experiencing this with the RecurringJob example seen here - http://www.talkingdotnet.com/integrate-hangfire-with-asp-net-core-web-api/
There is a fix for this in 2.1, but it requires a workaround.
A local function needs to be passed.
Instead of
BackgroundJob.Enqueue(() => Console.WriteLine("Background Job: Hello, world!"));
use
BackgroundJob.Enqueue(() => Test());
[AutomaticRetry(Attempts = 2, LogEvents = true, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
public static void Test()
{
Console.WriteLine("Background Job: Hello, world!"));
}
Another bug has been filed for this #14
Hello, I updated with the last version which seems to be supported in asp .net core
This is what I do:
GlobalConfiguration.Configuration.UseRavenStorage(ravenDBHost, "Hangfire");
var client = new BackgroundJobServer(); BackgroundJob.Enqueue(() => Console.WriteLine("Background Job: Hello, world!"));
I am getting an error such as this:
{Raven.Imports.Newtonsoft.Json.JsonSerializationException: Could not read value for property: Job ---> Raven.Imports.Newtonsoft.Json.JsonSerializationException: Could not read value for property:
at System.Reflection.TypeExtensions.GetMethod(Type type, String name) at Hangfire.Raven.RavenJsonMethodConverter.Read(Type type, Object value, JsonSerializer serializer) at Hangfire.Raven.RavenJsonConverterBase`1.ReadJson(JsonReader reader, Type type, Object existingValue, JsonSerializer serializer) at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) in C:\Builds\RavenDB-3.5-RC\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 1769 at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) in C:\Builds\RavenDB-3.5-RC\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 900 at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) in C:\Builds\RavenDB-3.5-RC\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 2005
**Could not convert document RavenJobs/c80515fa-c78f-4f12-a39e-4e5e30ea1060 to entity of type Hangfire.Raven.Entities.RavenJob**
I see that there is new record in the RavenDB
Please assist.