user4576114
user4576114

Reputation:

Hangfire is not working in real server

I have to schedule two task every 5 minutes in my ASP.NET C# project, create a zip file and add a log. I used hangfire to schedule my tasks, and it's working fine in local server. When I deploy it, none of them are working (zip or log is not created). When I looked into the hangfire dashboard, I saw the create zip is under Scheduled, create log is under Failed and the error message is System.UnauthorizedAccessException Access to the path is denied. I looked into this question and created a app.manifest and added level="requireAdministrator". But this did not help.

Upvotes: 3

Views: 3118

Answers (2)

Yuan Z
Yuan Z

Reputation: 333

Check the AppPool that your HangFire instance is running. Make sure the AppPool identity has the permission to access the resource.

Upvotes: 2

Saahithyan Vigneswaran
Saahithyan Vigneswaran

Reputation: 7143

Try this, first write all the methods you need to run in a new aspx page and run that page, in your case write the log function in a page and run the page you created (say writelog.aspx). If this prints the log, then you can try this.

Inside your schedule call function, call the page you created

WebClient client = new WebClient();
client.DownloadData("yourhostaddress/writelog.aspx");

Upvotes: 0

Related Questions