When publishing website on azure, webjobs are deleted - azure

When I publish a site on existing one where I created multiple webjobs, this deletes all the files on server and all the web jobs are deleted.
I assume this is because webjobs are stored in App_Data folder. When the APP_Data directory is deleted, the jobs are deleted.
How can I avoid deleting the app_data folder when doing a publish?

A third option to Andy's answer would be to deploy you WebJobs with your website, just make sure the WebJobs scripts go to the right place which is under app_data\jobs\{job type: continuous/triggered}\{job name}.
See more about deploying WebJobs: http://blog.amitapple.com/post/74215124623/deploy-azure-webjobs/

I noticed this as well and can offer the solutions I came up with.
If you are publishing from Visual Studio you can deselect the file publish option "Remove additional files at destination". Of course you are now no longer deleting unused files on the server which probably isn't ideal.
The other option is to simply create a second website just for your webjobs. You can leave the site blank, you don't need to publish anything to it or configure anything beyond the webjobs. One advantage to this approach is you can monitor (and potential scale) the webjobs site separately from your original website.

The solution I found was to exclude publishing to the App_Data folder.
If you are publishing using web deploy from Visual Studio 2013, you can enable this option as follows:
Right-click on the web project.
Click Publish...
Click on Settings
Expand File Publish Options and check Exclude files from the
App_Data folder
Close and save changes.

Related

Azure project - which subfolders/files should be checked into version control?

I am working on a small Azure project (using Visual Studio 2015). I have created a Azure Cloud service project with only one webjob. Inside the cloud service project, vs2015 created some subfolders like 'csx', 'ecf', 'XXXXXXXXContent', 'Profile', 'rcf'.
I wonder whether I should checkin these subfolders and the files inside. Of course, the 'Release' and 'Debug' folder inside these subfolders won't be checked in.
Folders with lowercases are generated during compilation and publish process.
csx: Packaged files which ready to be published. But as of Azure Tools v1.4, it is no longer generated unless you run in emulator. This blog post describes in detail.
rcf: which stands for Role Content Files. You already has ---WorkerRoleContent and rcf is generated through build configuration. You can think it as a kind of bin folder for contents.
ecf: It is generated folder for diagnostics settings depended on `diagnostics.wadcfgx' file. The file is specific for publish settings, so you should not include it in source control.
Overall, all three folders are automatically generated for publishing and they should not be added to source control.
However, Profile and ----Content folders are required to maintain your publish settings.

Is there a way I can publish an exe file to be in the same directory as an azure web job?

I have a web job that uses an exe that is best called when it is sitting in a directory and can be located. The problem is that I don't know how to get this exe to be published with the web job. I tried using a resources folder in the webjob project and copying them to output directory but that didn't upload them and so the only other option I can think of is uploading the files to a non temporary directory on the web site but that is leaking the encapsulation of the web job.
Any thoughts?
When you use visual studio to publish a webjob, it publishes all its dependencies as well. ie VS pushes all the dependencies available under the bin folder. So, add a reference to the dependent project and VS will take care of publishing this dependency as well.

Azure Website Continuous Deployment always picks up the wrong project

I have the following folder structure in my TFS online:
The folder names also match the project names in the solution.
Legend:
green dot: web api 2.0 project
red dot: class library
blue dot: console app added as a webjob to the web project
grey dot: console app only used for testing
Working folders for build definition:
The build definition was created automatically by connecting Azure to TFS online, and I have only changed the folder, so instead of the Team Project root folder, it points to the folder of this branch, containing the solution file and the folders in the first picture.
(This points to the folder which contains the solution files as well as all the subfolders from the first image.
Problem:
When I run a build, it always picks up the ExpiringRateCardsWorker project (even now the Web project has been renamed (both the directory and the project file) to start with an underscore, so it will be first alphabetically.
The deployment is successful, this is what I see in Monaco:
How can I make it pick up the web project?
Edit: Question was closed stating to be the duplicate of this. I have since tried the solution suggested there, but the /site/deployments folder is empty on the FTP, it doesn't contain the deploy.cmd, so my question is still not answered unfortunatelly.
I'm experiencing similar problem with deployment of MVC application to Azure using CD in VSO.
This problem is somehow related to WebJob Publishing mechanism.
For now I wasn't able to deploy my whole solution with WebJob in one go, but when I've deleted all webjob *.json files and Microsoft WebJobs Publish NuGet package from my solution, I've managed to deploy my MVC App normally.
I think I'll have to deploy this parts of the application separately, for now.

Force Azure Publish to create empty folder

I use Azure websites and my project must have an empty folder on the server. When I publish the project from the Solution Explorer (VS 2013), I don't get it created on the server.
For now, I keep an empty file there to force the creation but I was wondering if there is a proper way to make the publish process create it for me.
Assuming you are WebDeploy from VS to publish your site, I think the only way to force creating a folder is to have it on your client side. If you use kudu you can look at post deployment actions
I would suggest updating your code though to create the folder if it doesn't exist. That would make your code more robust and self contained rather than depending on a certain deployment mechanism to create the folder for you.

Publishing a Web Application from VS2012 is wiping out user content

I'm attempting to use Web Deploy to Publish a Web Application.
I want Visual Studio to delete any files that no longer exist, so I've checked the "Remove additional files at destination" setting in my Publishing profile.
However, I want VS to ignore the /Content/uploads folder, as it contains contents that my users have uploaded. Naturally, the contents are different in my development site than they are in the live site.
Unfortunately, I have been unable to discover a way to make Visual Studio ignore this folder when publishing (it wants to delete all of the content, since it doesn't exist in the project).
Does anyone know of a way to exclude specific folders on the target site from being examined by Web Deploy?
I had a similar problem, wanting to keep some files in the deployment package even though they're not part of the project.
Try to create a custom MSBuild target for this, that works for me.
Here is a Getting Started MSBuild reference
Hope this helps.
All the best.
I was unable to find a suitable solution for this issue, so I've created my own:
https://pubsync.codeplex.com/
PubSync enables quick and reliable file syncing for publishing Visual Studio projects.

Resources