Does any body knows a way to use the Hangfire in IIS6?
I am getting the following exception
This operation requires IIS integrated pipeline mode.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.
Currently it is not possible for use to update the IIS.
My question is it possible to use Hangfire with IIS 6?
According to this post, classic pipeline is not supported by OWIN. However, OWIN is required only by dashboard UI, so you can configure background server as written here and install separate console, service or web application with integrated pipeline for dashboard ui.
I am not sure what to do. I tried this link to initialize hangfire without the Owin and got the following error.
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
Stack Trace:
[EntryPointNotFoundException: The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.]
Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +356
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +113
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +87
System.Web.HttpApplication.InitModulesCommon() +172
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +828
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +304
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327
Coding
Private _backgroundJobServer As BackgroundJobServer
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
_backgroundJobServer = New BackgroundJobServer()
_backgroundJobServer.Start()
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' dispose the Hangfire
_backgroundJobServer.Dispose()
End Sub
Configuration to disable the Owin, as per this link
Remove Hangfire (it contains only links to dependencies, main package is Hangfire.Core, you should leave it installed) and Microsoft.Owin.Host.SystemWeb packages from your projects and delete Microsoft.Owin.Host.SystemWeb.dll from the project output path (bin folder by default).
JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
Stack Trace:
[InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.]
Hangfire.JobStorage.get_Current() +132
Hangfire.BackgroundJobServer..ctor() +32
HynneCo.ManageBase.Web.Global_asax.Application_Start(Object sender, EventArgs e) +90
Are you working in ASP.NET MVC? I created a blog post to install Hangfire in a non-MVC application.
Basically, you need to create a Startup.cs class like the following:
using Hangfire;
using Hangfire.SqlServer;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(YourNamespace.Startup))]
namespace YourNamespace
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
Hangfire.ConfigureHangfire(app);
Hangfire.InitializeJobs();
}
}
}
Notice the [assembly: OwinStartup(typeof(YourNamespace.Startup))] line.