question

IgorLopatchin293174IT-6985 avatar image
0 Votes"
IgorLopatchin293174IT-6985 asked BrandoZhang-MSFT commented

Not sure if the inner Cron Job is working inside my Web Api

I have deployed my MSSQL database and Web Api to Azure. I have a recurring job inside my code (I use Hangfire for it).117961-cron-problem.png
But I am not sure if it is working properly, and the data is scrapped daily and I have the Azure SQL Database updated. I see there is a possibility to use recurring Web Jobs using Azure. Maybe it is a better solution? What would you recommend? Also, how can I check if my Web Api actually scraps data every day with the current settings?

azure-webappsdotnet-aspnet-core-webapi
cron-problem.png (27.8 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

One of tags you are posting to is wrong you should be posting to one of the donnet.ASP.NET tags for WebAPI.

0 Votes 0 ·

1 Answer

BrandoZhang-MSFT avatar image
0 Votes"
BrandoZhang-MSFT answered BrandoZhang-MSFT commented

I suggest you could consider using Azure web jobs instead of inner Corn job, since the Azure web app's web job contains the specific portal which could see the execute result more easily.

If you use inner Corn job, you should check the internal logs or else to check if this jos is working well or not.

More details about how to use Azure web job, you could refer to this article.

Azure protal image:

118188-capture.png



capture.png (23.1 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Okay, I understand. But in my case I have a working Web API and once per day the application has to scrap all the data. For this I must use Cron. I have been watching a few tutorials, but neither of them explains how to trigger something in the Web Api using Web Jobs. Do you have any ideas?

0 Votes 0 ·
BrandoZhang-MSFT avatar image BrandoZhang-MSFT IgorLopatchin293174IT-6985 ·

Could you please tell me what you mean about trigger something in the Web Api using Web Jobs? Do you mean you wants to use web jobs call web api method? If this is your requirement, you could use web job to make request to web api. If you want to call web api build-in method, I don't think you could do that. They are different project. You need to write the codes insider the webjobs to scrap all the data.

0 Votes 0 ·