Im running a Windows-based App Service.
Im running a backup of a fairly large git repo and I'm wanting to clone directly to Azure Blob/File/S3. Cloning locally leads to an out-of-memory exception. I realise that you can mount azure storage, but this is just for Linux based apps.
Im using LibGit2Sharp ti run the Repository.Clone function. I've tried mapping a network drive on my Azure Webjob, but I get an "Access Denied"
When you create azure web app, if you choose option of Publish is Code, like below. It don't support net use command. These webapp are running in standard sandbox env.
Solution:
Create your web app like below. Docker Container will solve your problem.
Although the container webapp also runs in the sandbox environment, you can customize many configurations.
In local, I test net use command, which is same as windows container app.
Related
I have a C# application that is built using the .NET Core Web API template. This works great locally and I can access the rest endpoints in my application.
For example /api/person/0 where 0 is the id of a person.
The problem is with Azure. When I create an app service and use a github repository the app gets deployed. In the logs I see the following partial error:
Physical Path C:\home\site\wwwroot\api\gerecht\1
Azure thinks that my C# app is a simple website and tries to access the path as a physical file and not as an endpoint in my application. Why is Azure not accessing the endpoint?
Thanks
How did you deploy the application to Azure?
[Brute Force]
You may want to use GitHub Action from inside Visual Studio for this.
Right Click Publish
Azure (Select appropriate OS)
Deploy using GitHub Action
I experience this in the past and that was how I solved it.
Alternatively, you could use the Azure CLI from inside the directory that contains your .csproj file.
Official documentation here.
I am using CloudShell to deploy Azure Services using PowerShell Scripts. It's a great experience.Now I want to use CloudShell to automate deployment. I am maintaining a solution in TFS/VSTS.
Is there any way or workaround to call OR to get the CloudShell instance or to run Powershell on CloudShell using some Batch command or C# or else.
Is any CloudShell API exist to use CloudShell service from .Net
No, there's no API behind the CloudShell, but its just a bash shell that's using Azure CLI and Azure Powershell. You can use those on your own.
You can access the open source project for Azure Cloud Shell on github and run the Azure Cloud Shell container locally using docker. Not sure this meets your need, but it's a cool option nonetheless.
As per my knowledge, Azure Cloud is an interactive, browser-accessible for managing Azure resources. You cannot use Azure Cloud Shell for Continuous Deployment.
Note: Azure Cloud Shell is an interactive, browser-accessible shell for managing Azure resources. It gives you the flexibility of choosing the shell experience that best suits the way you work. Linux users can opt for a Bash experience, while Windows users can opt for PowerShell.
For more details, refer "Overview of Azure Cloud Shell (Preview)"
Problem
Getting a deployment error when trying to publish to an Azure Web App from TFS CI. A file is locked and this prevents the build from updating.
Symptoms
Publishing manually (Web Deploy publish from within Visual Studio) usually succeeds.
Stopping the Web App and publishing allows it to succeed, however this defeats the point of our CI if we need need to stop and start the Web App each time.
CI publish to Web roles and Worker roles don't appear to have this issue, we only get it on publishing to Web Apps (formerly Web Sites, the current Azure Portal term is now App Service).
Only publishing from a CI build via TFS fails consistently in this way.
Error
Web deployment task failed. (Web Deploy cannot modify the file
'msvcr100.dll' on the destination because it is locked by an external
process. In order to allow the publish operation to succeed, you may
need to either restart your application to release the lock, or use
the AppOffline rule handler for .Net applications on your next publish
attempt. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.)
The information at the link isn't very helpful.
ERROR_FILE_IN_USE
Diagnosis – A destination file cannot be overwritten or deleted because it is currently in use.
Resolution – Make sure that the destination file is not in use before performing a sync. If you are syncing content to a web site
hosted on IIS 7 or later (using the appHostConfig, iisApp, or
contentPath providers), consider taking the application offline during
the sync by enabling the appOffline rule.
Attempted resolutions
We were using New Relic - have since removed New Relic and this issue still persists. The binary appears to be a Microsoft library but it's unclear how it is relevant to the application (it's not referenced).
Some other SO questions have addressed similar issues with publishing but none of these relate to getting this issue from TFS CI.
azurew website continious deployment - Web Deploy cannot modify the file 'XXX' on the destination because it is locked by an external process
How to take web app offline while publishing?
One answer in the above question suggests using the EnableMSDeployAppOffline configuration in the publish profile, and adding this configuration works OK for doing a publishing manually from within VS but it doesn't fix the problem when publishing automatically from TFS/CI.
Edit
How to take web app offline while publishing? deals with taking the app offline using the EnableMSDeployAppOffline configuration - unfortunately this config only seems to be supported when doing WebDeploy through Visual Studio (not CI).
You can use the Web Deploy v3 in CI to deploy your web app.
In Web Deploy V3, we added support to automatically take an ASP.Net
application offline before publishing to it. This is useful if a user
wants to ensure that their application does not have a lock on a file
(e.g. SQL CE sdf files which only allow one connection to the file at
a time) being overwritten, or if they want to ensure that visitors to
their site cannot affect the publish process. When the publish process
is completed, the App_Offline.htm file will be removed and the site
will be online again.
Or you can add a PowerShell script like following to deploy the web app to Azure:
param($websiteName, $packOutput)
$website = Get-AzureWebsite -Name $websiteName
# get the scm url to use with MSDeploy. By default this will be the second in the array
$msdeployurl = $website.EnabledHostNames[1]
$publishProperties = #{'WebPublishMethod'='MSDeploy';
'MSDeployServiceUrl'=$msdeployurl;
'DeployIisAppPath'=$website.Name;
'Username'=$website.PublishingUsername;
'Password'=$website.PublishingPassword}
Write-Output "Stopping web app..."
Stop-AzureWebsite -Name $websiteName
Write-Output "Publishing web app..."
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"
. $publishScript -publishProperties $publishProperties -packOutput $packOutput
Write-Output "Starting web app..."
Start-AzureWebsite -Name $websiteName
Reference from: https://msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/deploy-aspnet5
The new "Deploy AzureRM Web App" task has an option to take the app offline which will prevent this error.
See screenshot for checkbox
I have an MVC4 web application that uses jquery and some other libs (jquery-ui in particular).
Yesterday I decided to update all the packages via NuGet package manager; my web application worked correctly on my local machine, but when I deployed it to my azure website a javascript error popped out in my browser (it was related to jquery-ui library, something like "$browser is not a function").
I searched the web and found out that the cause of this error was that I was still using an old version of jquery. It seems that deploy process didn't publish the new version of the js libraries even if they have been updated in local project.
I solved the problem connecting via RDP to the Azure machine, deleting the contents of "Scripts" folder and deploying again, but I'm wondering if there's a way to "force" script/libraries update when deploying to Azure.
Edit 1: I'm developing with Visual Studio 2012, using Mercurial as source control provider
Edit 2: I'm deploying to Azure Web Sites
Please, in your future questions clearly indicate what type of Azure Service do you use. An MVC4 web application can be deployed to 3 different type of services: Azure Web Sites, Azure Cloud Service, Azure Virtual Machine!
Since you are talking about RDP, the viable options are Cloud Service or Virtual Machine. But then you say
I solved the problem connecting via RDP to the Azure machine, deleting
the contents of "Scripts" folder and deploying again, but I'm
wondering if there's a way to "force" script/libraries update when
deploying to Azure.
Now the question is how you do deploy to Windows Azure? Is it via Visual Studio's Publish feature to Azure Cloud Service. Is it Visual Studio's Package feature and then using any other method of deployment (upload the package from the portal, use Azure PowerShell cmdlets, or use third party tool to deploy the package)? Is it integration with Mercurial and deployment is done automatically when you check-in?
Any any case, the issue you face is a mixture of NuGET failing to do real clean update of everything. Browser caching - especially for local development - IE caches all the scripts, CSS and images and it is hard to say (without explicitly deleting all locally cached files) which script are you actually using. Simple version control issue - keeping old and new scripts.
When you do a JS/CSS updates I strongly advise all the customers to first delete all browser's cache (crtl+shift+del - works for all browsers) before testing locally.
I highly doubt that if you use a Cloud Service, RDP-ing and deleting anything in the sitesroot folder will help you when you redeploy. What you do in the ROLEROOT drive (usually E:, sometimes F: drive) is dropped of/forgotten when you re-deploy regardless of the re-deploy method you use: in-place-upgrade or full re-deploy. So what you did is actually creating new package and re-deploying your new package.
The fact that you deleted some folder has no effect on your re-deploy action.
This is my first time trying to develop a windows azure application on my visual studio 2010.
what I have done so far is:
Open new project > C# > Cloud.
Downloaded the SDK.
Add new class with code that only displays my name and age.
try to run this code locally and failed!
My questions is:
am I able to run the application locally? if yes the how?
How can I deploy the application? (I already have an account)
Well for what I see your problem is not your windows azure sdk, the thing is that you are creating a WorkerRole project which is a Class Library type and that won't give you an output, for that you need to create a WebRole project.
here I let you this tutorial, it would show you how to create your first WebRole project.
http://www.dotnetcurry.com/ShowArticle.aspx?ID=801
And this one would show you how to deploy on the cloud
http://www.developerfusion.com/article/125435/deploying-an-azure-application
What type of application are you trying to build? Your error is because you are trying to run a class library, which isn't an executable.
There are primarily two types of applications that are hosted in Azure:
Website - These are just standard ASP.NET WebForms or MVC projects, hosted on Azure. These are the easiest to get going, and with the latest Azure release, require nothing special. Simply create a Web project, and git deploy to your Azure Web Site
Worker Role - Worker roles are usually for background tasks like performing computations, sending emails, distributing work, etc. These can effectively be thought of as console applications that never end.
For example:
while(true)
{
// do work here
Thread.Sleep(5000);
}
When developing Azure applications, you need to either create a website (WebForms, MVC, WebAPI), a WCF service, or a console application to run as a background worker. Once you've built the application locally, then you can add an Azure Cloud project, which will handle the actual deployments.
Yes, you can run your application locally: Select the Azure application project in the Solution Explorer, right click, "Set as StartupUp Project" and run
To Publish: goto https://manage.windowsazure.com/ . Create a new web role and download the publishing settings.