Hangfire.Core.Dashboard.Management
Hangfire.Core.Dashboard.Management copied to clipboard
Form values are null
I am using your library in a self-hosted application. No matter what values I set for the schedule or cron expression, the values are never used. I stepped into the library while debugging, and in the ManageBasePage.cs, in the callback for the CommandWithResponseDispatcher, these lines always return null from the inner Tasks (lines 106 and 107):
var schedule = Task.Run(() => context.Request.GetFormValuesAsync($"{jobMetadata.DisplayName.Replace(" ", string.Empty)}_schedule")).Result.FirstOrDefault(); var cron = Task.Run(() => context.Request.GetFormValuesAsync($"{jobMetadata.DisplayName.Replace(" ", string.Empty)}_cron")).Result.FirstOrDefault();
Any idea on why or how to fix this?
I am seeing the same.
For my IIS-hosted application I was able to work around it by adding a reference to System.Web and reading from the HttpContext.Current.Request.Form
collection. However this is clearly not an Owin-compatible solution.
Note: I initially started down the route of accessing context.Request's private Microsoft.Owin.OwinContext _context
field by reflection, but quickly ran into a dead end due to a version mismatch between my Microsoft.Owin dll and the one Hangfire.Core was using. Perhaps there are some (compilation/compatibility) issues in Hangfire.Core causing OwinRequest.ReadFormAsync()
to return empty results under certain hosting scenarios?