How to debug Web API through a separate Web project on same machine? - asp.net-mvc

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)

Related

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

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.

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.

Can a existing MVC2 application migrated to Azure Cloud Service Project?

Currently I have MVC2 web application(on going). If I'm to use Azure PaaS (Platform as a Service), Can I use the existing project. Or should I create new project (using Cloud service project template)? Can it be migrated? And what kind of effort will it take for migration? Or should I rewrite the entire application with new project template?
You don't have to rewrite the project itself, you can simply add another project to your solution (which is a cloud project) and then point it to your other project in the associated definitions.
This is a useful technique when you already have existing projects that you want to migrate to Azure.
Not sure if this would work with MVC 2 web application but you can simply try to convert the web application to Cloud Services project by right clicking on your project in Visual Studio (I used VS 2013), then Convert context menu and then selecting Convert to Microsoft Azure Cloud Service Project.

TFS 2013 Team Build/WIX/ASP.NET MVC Project

I'm trying to design a WIX setup project that needs to harvest the output of an ASP.NET MVC Web site.
There are several problems.
Building the ASP.NET project does not output the same content as a web publish would.
So it seems that I need to harvest the output of the published web site, meaning it should be done in a temporary location.
It should work on team build continuous integration (and in Visual Studio).
Every sample I've found so far uses temporary directories and command line steps before building the setup project.
Am I wrong ?
Is there another solution ?
Thanks in advance.
You would need to run those commands as part of your build so that you have that output to then package with WIX.

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