Can't run Azure WebJob ManualTrigger attached to Azure WebSite - azure

I have created an Azure WebSite in Visual Studio. I then added a Azure WebJobs project through Visual Studio. I then provided the connection string to my storage account to both the app.config file of my WebJob project and the web.config file of my WebSite project.
I still cannot get the job to complete successfully. It keeps failing, as I can see that on the Dashboard. When I go to the Dashboard, not only do I see the job failing every time I run it, I also get a red notification that my connection string is incorrect for the AzureWebJobsDashboard. I've provided this connection string in both projects, and I've copied from the Azure Portal, so there is no way I'm getting the connection string wrong.
How can I fix this? I'd like to start creating real WebJobs, but I can't even get the example one to work (the one given to you as a ManualTrigger when you add a WebJob project in Visual Studio).
update
I had forgot to mention that this connection string is also in my application settings in the azure portal already and I still see failures.

Try adding the connection strings on the Application Settings page of your WebApp in azure.
UPDATE
Use a General-purpose storage account to get rid of
System.InvalidOperationException exception.

Related

Why is webjob log not showing proper failed message?

I am trying to execute a manually triggered webjob. The system automatically gets failed without showing any proper failed message. I even added application insight to the program but i can't see any failed log in application insight as well.
My main application calls different interfaces and methods from different projects. I have linked all of them by adding references in my main project. I uploaded my webjob simply by using visual studio 2017 feature Publish Azure Webjob
App.config screenshot:
I have couple of connection to Azure file share and one for Database(Microsoft SQL Server)
When I am uploading .exe file from bin>release and then when i am running it this error message is showing up:
The issue is with adding reference to class library from my console application. Although the issue still persist but now at least I know where I am going wrong.
We have reproduced the issue from our end and faced the same problem while deploying the webjob from Visual Studio.
But we have successfully able to run the webjob as you can see in the below attached screenshots for your reference.
Points to be re-checked from your end to publish the webjob to azure app service without any errors:
Make sure after creating the webjob ->open the app.config file in the VS and add the below configuration properties under the <configuration>:
<add name="AzureWebJobsDashboard" connectionString="place your storage account connection string here"/>
<add name="AzureWebJobsStorage" connectionString="place your storage account connection string here"/>
We have used runtime .net framework as Version=v4.7.2 in Visual Studio 2017.
Note: copy and paste the same storage account connection string for both the above properties in app.config file i.e. AzureWebJobsDashboard and AzureWebJobsStorage.
After adding these properties in the app.config file -> save it and right click on the solution explorer tab in Visual studio and build:
Then publish to azure from the solution explorer tab in VS:
Now go to the App Service in azure portal and select webjobs then run the webjob and click on the logs tab to show the results page as shown below:
If the webjob gets successfully deployed then you can see the status as Running like in the below screenshot:
If there are any Errors after the deployment then you can see the error messages by clicking the toggle output screen and troubleshoot based on the error message like below:

Azure Devops Pipeline returning: 'Failed to deploy web package to App Service. Internal Server Error (CODE: 500)'

I am trying to use Azure DevOps pipelines to build a .NET 5 (Core) web app and deploy it to my Azure app service. I can't find any complete examples in the documentation that achieve this so I'm following this:
https://github.com/shahedc/NetLearnerApp/blob/main/azure-pipelines.yml.txt
However, the Azure deploy task keeps returning this vague error:
In my Azure portal I only get this error:
I am assuming the issue is in my pipeline because deployment works when I deploy it directly from the Deployment Center in the Azure portal. Here are the details for the 3 relevant tasks my pipeline:
I found the solution. It turns out the issue was not in the pipeline, but was caused by a Git connection to the app service I had previously set up in the Azure Deployment Center. Even though I disconnected/removed this Git connection, there was somehow still a residual file left over in Azure that was causing the error. I deleted the 'deployments' folder in Kudu (pictured below) and the pipeline started working as expected.
Getting to the above pictured view:
Navigate to your Azure Function project
Search for Advanced Tools
Open PowerShell
Check if you have disk space available.
Yesterday we started getting this error, even if we tried to re-deploy packages that were successfully deployed just an hour before. Our system guys checked and found out that we reached the space limit and that it was time to upgrade.
P.S. I know that this was answered a long time ago. I am just sharing the solution that was not mentioned here and that worked for us.
think what Dan Beaulieu said in above answers is correct, but one thing to add, in my case, after deleting the deployments folder, remember to restart the app service/web app, which will make it take effect.

Publishing Azure functions

I work with several azure functions on a project that I didn't setup on my own, and when I try to publish the project which includes those azure functions to update them, the publishing failed with the following error :
Web deployment task failed. (Connected to the remote computer
("demo.scm.azurewebsites.net") using the Web Management Service,
but could not authorize. Make sure that you are using the correct user
name and password, that the site you are connecting to exists, and
that the credentials represent a user who has permissions to access
the site.
Where do I provide credentials ?
Here are the steps to publish an Azure Function from Visual Studio.
Go to the Azure Portal
Go to your Function App.
Then, select Overview and click Get publish profile and save the file.
Next, go to your Visual Studio project.
Right-click on your Azure Function project.
Select Publish and then Import Profile.
Finally, hit publish.
All the information needed, including your missing credentials, is in that the profile.
I have the exact same issue. Tried to publish and get the exact same error. I did as kzrystof suggested and downloaded the publish profile from the Azure portal and imported it into VS2017. As soon as I pick the publish profile file and click the open button I get the "Publish failed" error message. I checked the output window to find out what the error was, but there is nothing new added to the output. I cleared the output window and clicked the Publish button and immediately receive the "Publish failed" error popup with no further details in the output window.
Update: I was able to successfully publish the Azure Function App by creating a new profile in VS2017 to a new instance up on Azure. I then removed the old instance from the Azure Portal. Successive attempts to publish from VS2017 then worked successfully.
Just as a test, I downloaded the publish profile from the Azure Portal for this new AF app and imported it into VS2017 and still this produces the same "Publish failed" error popup. MS still seems to need to do some work on that scenario.
Also, there still seems to be problems with ZipDeploy so avoid it for now. I keep having timeouts when trying to publish using ZipDeploy. Standard WebDeploy publishes the files individually and thus doesn't have timeout issues.

Error log for Azure cloud service deployments

I'm getting the following error while trying to publish an Azure cloud service (classic) from Visual Studio:
There's so little information in that error that I have no idea what to start fixing. Is there a more detailed log somewhere, and what steps (if any) need to be taken to enable it?
The solution for me that works is to refresh the Azure connection. I use for that the Server Explorer - expand the needed service branch lead to the solution.
The solution can be refresh the credentials as well. It may be connected with the Visual Studio or Azure SDK versions, so it is worth to try to start from reinstalling at least Azure SDK.

Azure WebJob running old code

We have a bug in our WebJob running in our live environment, I have identified the bug and fixed it, this I can verify in our Dev-environment. I published my WebJob as a "Azure WebJob" to our live environment but the bug i still present. To add to the confusion the bug now just occurs sometimes. So for some reason the old code is running somewhere sometimes.
Can someone please help me understand this?
I had a similar problem. We deploy using a stage environment in Azure and it turned out that the "old" WebJobs (running code with an old version of the entity framework model) where still running on the queue. These jobs where then fetching messages and consuming them. To add to the problem the exception was consumed in a try catch and the status of the WebJob was success.
Check if you have a stage environment (add -stage to the Webapp name) and if so go in to the Azure management portal and stop them.
Note, it is not enough to stop the Webapp, you must stop the WebJobs directly. This is done (in the new portal) under Settings->WebJobs and then right-clicking on the webjobs name selecting stop.
I spent ages looking into this problem. Turns out I had the web job project running in a console on my PC at work! No matter what I did on Azure the presence of this exe running and using the same storage for the web jobs meant that the old code running on my work PC picked up the jobs before Azure did. Easy fix: just make sure no exes are running outside of Azure!
In our case the web app was published to physical path /site/www instead of the default /site/wwwroot, because of this the Azure web portal interface adds the WebJobs to folder /site/jobs, but the webdeploy via VS or Azure are still trying to publish the webjobs inside the /site/www.
More details at Publishing WebJobs with Azure Pipelines

Resources