Hangfire.Core.Dashboard.Management icon indicating copy to clipboard operation
Hangfire.Core.Dashboard.Management copied to clipboard

Form values are null

Open timohayes opened this issue 6 years ago • 2 comments

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?

timohayes avatar Jun 01 '18 22:06 timohayes

I am seeing the same.

DaveA-W avatar Sep 13 '18 05:09 DaveA-W

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?

DaveA-W avatar Sep 13 '18 07:09 DaveA-W