How can i get back asp.net code from azure web app? - asp.net-mvc

I had published my application on azure web app and by mistake deleted the repository. Now how can I get back my code from the Azure web app? I had to try kudu but it's given an understandable format. the app in asp.net core.

For now if you want to download the web source code, you could go to the kudu site, Select Debug console -> CMD from there you can go inside site -> wwwroot and select download.
However note that this is the deployed code, and it won't be the source if you are using a compiled language such as C#. When you publish from visual studio or any CI tool the files gets published in compiled form.
The option is you can use github deployment to maintain repository which contains all source file.

Related

ASP.NET MVC Deployment to azure

So I'm trying to deploy a test site to Azure.
The site has a database which was built in SQL server management studios, then I used ADO.NET Entity Data model to import the database into visual studios. Then I just used scaffolding to create CRUD operations.
How do I deploy this web app to Azure?
I used a database first so I'm not sure if that's a problem
I've tried following some tutorials but they seem to have different UI
eg. https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/database-first-development/publish-to-azure
First you want to go into Tools in your nav menu and check for 'Get Tools And Features'. Make sure you have Azure tools installed, and from there you'll be able to access the Azure menu to publish your web app directly from Visual Studio. You can also do this in VS Code, however you'll need the official Azure extension from Microsoft.

How to debug Web API through a separate Web project on same machine?

I'm taking over a project from someone who is no longer avaiable to ask how/why their prjoect works.
I have two solutions, one a MVC project and the other a Web API. The MVC project calls the separate API solution to do some validation of data. If I start up the Web API project it runs on localhost:64633. Then I need to start up the MVC project so that I can step through the code and all the way through the Web API.
Thing is that the MVC project runs on localhost:64633 as well so once I have the API running and then try to debug the MVC project I get an error "Unable to start program localhost:64633. An operation is not legal in the current state.".
How can I debug both the MVC project and Web API project at the same time?
Run Your project using local IIS server, follow below steps for that
Right click on project file choose property
Go to Web tab, under the Servers header choose Local IIS
Then click "Create virtual Directory" button
Do above steps to both project. please try now
Note : Run both project with in single solution, automatically debug both project at a time.(Just suggestion only)

Publish ASP.Net MVC Site (created in Visual Studio) to Azure using Azure Cmdlets

I have a ASP.Net MVC Project in a solution which contains multiple other Class library projects (which are dependencies of MVC project).
Now I want to automate the process of creating multiple DEV AzureWebsites and publish the MVC project (along with its dependencies) through Azure PowerShell Cmdlets.
I know how to create AzureWebsite and other Cmdlets, but I am not sure about how to publish VS MVC Project, take that folder and deploy it in AzureWebsite. Please let me know my options.
PS - I do not want to Visual Studio -> Right Click publish option, because I need to create multiple instances of Dev AzureWebsites.
Good news. The script to do this is already written for you. In Visual Studio, take a look in the PublishScripts folder of your solution. There you will find the scripts and parameter file for your solution. You can use these to publish to other Web Apps (formerly Websites).
The dependencies will be included in the package file that is generated so no additional steps are needed for that.

TFS 2012 - Continuous integration with a website

I have a solution with multiple C# projects linked to a Website (File => New => Web Site).
I can use the continuous integration for all the C# project for now.
I would like to try the website from a different solution just for testing:
I would like to know if the modification of an aspx or aspx.cs file will
rebuild all the solution/project or just push the file which was
modified on Azure.
It seams that the website will be rebuild, or will try to rebuild.
Here is my website test solution
and my Build Definition file :
So my question is, is it possible to integrate a website to a continuous integration system ? (TFS 2012)
If it's possible, What did I miss on the basic configuration ?(I didn't need any specific configuration for a WebApp project or a C# project)
I might need to build some files on the website (App_Code folder), But I would keep the possibility to deploy only the modified files (aspx, aspx.cs) without rebuild all the website and push everything on the server.
Let me know if you need any further information
There is an article here Continuous Deployment di Asp.Net web sites con TFS Build. It is in italian, but I think you may get the core using Bing/Google translator.

Clean Windows Azure Website

My ASP.NET MVC project pushed to a Azure website with an extra DLL which is invalid. This is keeping the project from running correctly. If a new website is created it works perfectly. Cleaning the project locally and redeploying does not fix the problem. Is there a way to perform a "remote clean?"
This project is being deployed directly from Visual Studio with the publish menu item.
When you right click and click Publish Web on the left hand side there should be a settings tab. Click this. Then expand the option under File Publish Options and check the Box for Remove addtional files at destination. (This will wipe out whats already there)
Also can be detailed here: MSDN
Another trick to delete an entire Azure website deployment which can be done entirely in the Azure portal is:
1) Create a new empty deployment slot under the Azure website.
2) Swap it with the parent Azure website.
That will give you an empty Azure website. If you want you can delete the deployment slot afterwards.
You can also use console to delete any file. Kudu is a web tool that allow you to see inside of Azure web application.
Two ways to access Kudu
go here: https://yoursite.scm.azurewebsites.net/DebugConsole/?shell=powershell (replace with your real website name)
login to portal > app services > your site > Development tools > Advanced tools.
You can also delete files via Webmatrix (link in footer menu in Azure configuration portal)
Download the profile from Azure portal
Import publish profile in VS
Stop the web app in Azure portal
Stopping the web app ensures existing files including dlls and other resources will be deleted after publish succeeds.
This step might not be necessary, however, the existing web app could have some dlls that cannot be removed during publish directly, returning error messages like:
Web deployment task failed. (Unable to perform the operation ("Delete
File") for the specified directory ...
4. Publish with “Remove additional files at destination” checked
Start the web app again after publish succeeds.
for linux servers you dont get, CMD, then all you have to do its, Delete the deployment, then create deployment credentials for FTP and there you go with FTP client clean the wwwroot folder by your self.

Resources