The type '' does not contain a method with signature

I have a web application which has Page1.aspx that does task1 and then enqueue task2 to scheduler in fireAndforget manner.

I am using Hangfire and everything is installed and worked correctly but only once when doLongJob() had no parameters (while testing). Then I added a parameter (and I will be adding more). After that I am facing these errors.

Can not find the target method. The type ‘’ does not contain a method with signature doLongJob(String)

Page1.aspx.cs

string strMsgID = //task1 returns a value;
BackgroundJob.Enqueue(() => doLongJob(strMsgID));

public void doLongJob(string strMsgID)
{
    int status = //task2(strMsgID);
    while( status == 2)
    {
        Thread.Sleep(10000);
        status = //task2(strMsgID);
    }
}

Startup.cs

using Hangfire;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(erp.Startup))]
namespace erp
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
 
            app.UseHangfireDashboard();
 
            app.UseHangfireServer();
 
        }
    }
}

Global.asax.cs

protected void Application_Start(object sender, EventArgs e)
{
    GlobalConfiguration.Configuration.UseStorage(new MySqlStorage("hangfire"));
}

please try to write method doLongJob in public class then use it in Page1.aspx.cs

try like mentioned below

Page1.aspx.cs

public partial class Page1: System.Web.UI.Page
      protected void Page_Load(object sender, EventArgs e)
        {
        string strMsgID = //task1 returns a value;
         job j=new job();
        BackgroundJob.Enqueue(() => j.doLongJob(strMsgID));
      }
}

public class job
{
     public void doLongJob(string strMsgID)
     {
         int status = //task2(strMsgID);
        while( status == 2)
       {
        Thread.Sleep(10000);
        status = //task2(strMsgID);
        }
     }
}

@Dax_Francis
It is actually in a file ‘global.cs’ with the same signature. I put it there to remove any confusion for it.
As mentioned previously, this whole thing worked before I put changed the signature of doLongJob and added a String parameter.

Did you find a solution to this ? I have the same issue