A website with webjob not deploying to Azure.
I am having an issue getting a website with an associated webjob console application to deploy using continuous deployment via Visual Studio Online. I am using VS2013 with update 4 and latest Azure SDK.
The website, and the associated webjob, will publish to Azure using direct publish for Visual Studio and works perfectly, so I am confident the publish settings are fine.
The solution will build and work locally fine.
The solution, once checked in, will build and (seemingly) deploy fine in VSO (using CI) and Azure notes the build was successful and shows it as 'Active deployment'.
However, the website and associated webjob will not be updated.
When I have browsed the deployed files after the VSO build and deploy on Azure, all that is happening, is the binaries of the console app are being copied into the bin/ folder of the website.
None of the website files are being updated. It is almost as if it is deploying the wrong project!
If I remove the Webjob and just deploy the website, it will build and deploy fine through VSO - the website will update.
It is adding the webjob that causes some issue with the deployment via VSO.
I am confident all steps are correct to add the webjob to the WebApp, with the correct webjobs-list.json being added to the webapp and webjob-publish-settings.json to the Console app - as I said, publishing the website (with the webjob) direct to Azure works perfectly, and both the site and webjob get updated.
I have searched post after post and tried all manner of things, but none have worked.
Given the fact this published fine direct from VS, and also that the build is completing, it would suggest that something is wrong with the VSO Build Defintion.
My first guess would be to change it from building the solution to instead building the web project only, but this does not seem to work.
I have also tried every Output location setting (both for the solution build and the web project build) - the only one that works and the build completes is the solution (.sln) build with 'SingleFolder' set.
I have been battling this for a couple of days now an I'm a bit stumped!
This also happens if you have a static website being deployed using a Visual Studio solution via VSO with an automated build - unless the Visual Studio project / solution containing the website is changed then the actual site contents will not be redeployed.
I think your hunch that it's deploying the wrong project is correct. If you have multiple "deployable" projects in your solution (and the console app is considered deployable, as this is one way you can host/deploy a webjob), you need to tell Kudu which one to deploy.
You can control it adding a new setting under "app settings" on the "configure" tab for the webapp.
The setting you want is Project and it's a relative path from the solution root to the .csproj file of your web project.
Alternatively, you can specify the setting in a custom .deployment file.
Relevant Kudu documentation here
From the documentation:
You can specify the full path to the project file. Note that this is not a path to the solution file (.sln), but to the project file (.csproj/.vbproj). The reason for this is that Kudu only builds the minimal dependency tree for this project, and avoids building unrelated projects in the solution that are not needed by the web project.
Here is an example:
[config]
project = WebProject/WebProject.csproj
I have also tried every Output location setting (both for the solution build and the web project build) - the only one that works and the build completes is the solution (.sln) build with 'SingleFolder' set
That's the root case of problem.
You can't have SingleFolder as it sets the OutDir which mess up with web job packaging.
I had to introduce a wpp.targets files in each of my web app project to create the publish package to a particular path (using PackageLocation)
So, let each project have that and set the setting to AsConfigured (or Per Project) instead of SingleFolder.
See this
Related
I am trying to stand up a sitecore site inside a fresh app service in Azure. This already works in our production Azure account, but we would like to see how to set it up from scratch.
The build and deploy succeed in pushing it out to the app service, however, I am getting:
Could not load file or assembly 'System.Web.Http.Cors, Version=5.2.3.0
and no further information. I verified that system.web.http.dll is present in the bin folder. I read in some other articles that sometimes the wrong version could cause issues but this works on my work machine. Is there another step I need to do to make this work in an app service? Some configuration change, maybe?
The dll is missing in the published (deployed environment). That is the reason why it is working in the local i.e. Visual Studio but not in the Azure Website Environment.
Just do Copy Local = true in the properties for the assembly(System.Web.Http.Cors) and then do a redeploy, it should work fine.
If Copy Local is already set to true and you cannot update the WebApi because of dependencies, there is that trick to set Copy Local to false, build, then set Copy Local back to true and build.
The project was generated through Ionide and Visual Studio Code. I'm deploying to an Azure WebApp through GitHub.
The GitHub repository is: https://github.com/laygr/suave-dummy
The activity log says:
Command: build.cmd
The system cannot find the path specified.
�
The system cannot find the path specified.
D:\Program Files (x86)\SiteExtensions\Kudu\59.51109.2534\bin\Scripts\starter.cmd build.cmd
It is as simple as a Suave app gets. I hope that this can help others.
Edit
After restarting fresh again (new repo, new web app, new day, new hopes), azure showed a different error which allowed me to figure out the rest. I'll leave the repo so that anyone can see how to deploy the simplest Suave app as an Azure Web App through GitHub
So, after an improvement on the error shown by Azure, I could figure out how to deploy the app.
I had to:
remove .exe from the .gitignore generated by Ionide for Visual Studio Code.
create .deployment
create web.config
modify the build.cmd (I copied it from somewhere else)
modify the build.fsx to perform the correct build
modify the startup file (suave-dummy.fs) to use the correct port
Feel free to check the repo to see what I mean in code. Relevant files:
.gitignore
.deployment
suave-dummy\WebHost\web.config
build.cmd
build.fsx
suave-dummy\suave-dummy.fs
phew!
In Visual Studio, I am deploying a web site to Azure via the Publish menu option, and the project has an existing web job added to it (via the Add menu). It was added as a continuous job, and has the correct entries in the 'webjob-publish-settings.json' and 'webjobs-list.json' files.
When I publish the web site, the job is compiled and put into place in the 'jobs' folder and published with the web site. However, it is not started. No entry is added automatically to the WebJobs settings page in Azure, which remains empty. There are no errors in the output window.
The Azure webjobs documentation states that it will attempt to run a selection of files from within the webjob directory, and one of these is any file that ends with ".exe". The webjob project is a console project, and compiles into an exe which is published in the directory.
In the past, I have published this job by zipping the contents of the 'bin\Release' directory, and adding it manually.
How can I debug why it does not start when deployed automatically?
First thing you should do is look at exactly what got deployed, to make sure it looks like what you expect. To do this:
Go to Kudu Console
Go to D:\home\site\wwwroot\App_Data\jobs\continuous
You should see a folder named after your WebJob in there. Go in that folder
Check that it has all the right files
If it doesn't, then you likely have some kind of deployment issue, and it is not an issue with the WebJobs runtime.
I think when you published the Web site, it just copied over the Webjob files but Azure does not know that there's a Webjob that has been published. Could you please try publishing the WebJob separately by selecting "Publish as Webjob" option. If it has problems publishing that way then there's some problem in your Webjob, like app settings etc, and if it is successfully published then I guess you have to publish it separately every time or find a hack in Publish settings of the Website to publish both the projects.
Hope it helps. Thanks
I had a web job that was working fine, I stopped it, changed a value in the config file and started it again. It didn't start, no errors, no log issues, nothing at all.
How I fixed it? I clicked "Restart" button in the app service that contains all the web jobs.
Note: stop and start did not work, only "Restart" did the trick. It really makes no sense but that's what happened. I hope it helps others with the same issue.
So I'm building an MVC6 app in Visual Studio 2015 and have managed to figure most stuff out, however, I haven't yet worked out deployment.
In MVC4 (what I was using before), our process* was publish to a folder, then setup the website in IIS (Right-Click on Sites -> Add Website).
Actually, our process is set it up in IIS and TeamCity, but not for test apps like this :).
I followed this process and obviously it's trivial to setup the IIS website and publish to the correct folder...but that does not actually work for me.
We're running IIS 8 on Windows Server 2012 and we've installed the .Net 4.6 runtime on the server.
The following steps have worked for me and should help you host your project on IIS.
Using Visual Studio 2015 Preview as your IDE,
Create an ASP .NET 5 Starter App.
Check that it is working outside of IIS.
Once complete, publish the application. In this example, I have selected the location C:\PublishWebApp.
3.1. When publishing your application, make sure that you have:
Disabled precompilation
Selected amd64
(See image below)
Upon a successful publish, go to C:\PublishWebApp.You should see the folders approot and wwwroot inside.
Now open the IIS Manager (I am assuming you have the ASP .NET 4.5 feature enabled)
Create a new website.
6.1 : Select the wwwrooot folder as the website's physical path. In this example, it is C:\PublishWebApp\wwwroot.
Check the website to see that it is working. If you encounter any errors, please post them here.
If the precompile option is ticked in the Publish Web Settings window pictured above, then you must
Go to the wwwroot folder of your published web application. In this example, it is C:\PublishWebApp\wwwroot.
Locate web.config.
Inside the folder of your published application, there is an packages folder inside of the approot folder which should contain a folder named after your application, with a folder for the version underneath. Inside that folder should be a folder named root. In web.config, set the value for the key kre-app-base to the root folder. For reference, see the line of code below. In this example, the application name is WebApplication10.
<add key="kre-app-base" value="..\approot\packages\WebApplication10\1.0.0\root" />
I Spent hours on debugging the issue finally got it worked, steps:
1) Publish your MVC6 application using visual studio into file system, make sure you are selecting correct DNX Target version in my case its dnx-clr-win-x64.1.0.0-rc1-update1.
In the output folder map "wwwroot" folder to your applicaiton in IIS (DO NOT Map it to sup-applicaiton, only ROOT application in IIS works with DNX for example "Default Web Site").
I have just spent a day trying to get this working. i found this here (search for posts by GuardRex) invaluable, complete the steps the accepted answer gave, that's the start of it.
Pretty much if you try to add an application to a site there is bunch of workarounds and extra configuration needed that is detailed in the link.
For starters:
1)Make sure you have the HttpPlatform handler installed here
2)Seems obvious but make sure .net5 is installed on your server here
I know this is if you are adding an application to a site, but there's some pitfalls and much needed refinements needed for the deployment process at the moment that everyone should be aware of.
I'm trying to publish my WebJob which is connected to an Azure Website. So I use Publish on the website. This will publish the site and inside the App_Data-Folder the files for the WebJob are deployed.
The problem is, that I use the NuGet package Microsoft.SqlServer.Types inside the WebJob which brings 2 dlls one of which is a C++ native lib. This dll lays in "/bin/SqlServerTypes" of my WebJob-bin-folder which wouldn't be deployed by the publish-operation. Only items directly laying inside of the bin-Folder of the WebJob are deployed.
How can I ensure, that the complete bin-folder from the WebJob-project is deployed to App_Data on the web?
What I tried so far is:
Adding a project-reference to the WebJob-project in the WebSite-project.
Generating the folder-structure under App_Data in VS and referencing the dll there.
Edit: Turns out, that I had a simple spelling bug when creating the structure beneath the App_Data-Folder. In my case it worked when I just added those dlls in the folder the tooling expected them to be. See the answers for other good links.
I had a similar issue. Check this out.
As far as I know, this hasn't been solved yet. A workaround is to copy the relevant dependencies via FTP.
Hope this helps.