question

EspenJohannessen-5003 avatar image
0 Votes"
EspenJohannessen-5003 asked ·

Console App running as Web Job not able to access Azure Blob Storage

I have a simple part of a .NET console application running as a Web Job under an App Service. It checks if a blob exists in a specified container:

 var blobServiceClient = new BlobServiceClient(connectionString);
 var containerClient = blobServiceClient.GetBlobContainerClient(customScriptsContainer);
 var blobClient = containerClient.GetBlobClient(scriptFile + ".cs");

When I run the console app on my localhost everything works fine, it connects and retrieves the blob if it exists.

But when running in Azure - with the exact same connectionstring and container name - the code times out on the last line with an error "Retires failed after 6 attempts".

It seems like it is not able to get a connection to the storage account at all.

Can it be something the needs to be configured/opened between the App Service and the storage account?

azure-webapps-webjobs
10 |1000 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.

1 Answer

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered ·

Thanks for asking question! Just to confirm if you are using Version 3.x? As Version 3.x of the WebJobs SDK supports both .NET Core and .NET Framework console apps and for this you may refer to official document on outlined steps to deploy WebJobs. To add to this Starting with version 3.x, you must explicitly install the Storage binding extension required by the WebJobs SDK.

· 5 · Share
10 |1000 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.

@EspenJohannessen-5003 Checking in to see if the above answer helped. Let me know if there are still any additional issues we can help with.

0 Votes 0 · ·

Hi, and thanks for you reply.

I have not used the SDK, just used the azure.storage.blob package to try and connect directly to azure from the .NET Framework console application. I tried implementing the SDK version 3.0 way of doing things, but it did not make any difference. Running the application on localhost everything is fine, but when running in azure i get a timeout :

 One or more errors occurred. ---> Kudu.Core.Infrastructure.CommandLineException: Command 'cmd /c ""CurrentBat ...' was aborted due to no output nor CPU activity for 120 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.

I am now trying to work around the problem by using the Azure Storage REST-API instead of the .NET client libraries.

0 Votes 0 · ·
SnehaAgrawal-MSFT avatar image SnehaAgrawal-MSFT EspenJohannessen-5003 ·

Thanks for your reply! Could you please ensure the job is running as a continuous job and not a triggered job? Check if Always On feature is enabled on your Web App settings.

Also, for triggered WebJobs the way to increase idle timeout is using the app setting: WEBJOBS_IDLE_TIMEOUT. Set it to your desired timeout in seconds. From the Azure Portal go to Application settings and set its value to 3600.

You may refer to this link might be helpful: https://github.com/projectkudu/kudu/wiki/WebJobs

0 Votes 0 · ·
Show more comments

By the way, does anyone know the supported .NET Framework version that webjobs now support?

0 Votes 0 · ·