We are having a application developed in MVC 4.
Here are our scenarios:
1) we are following plugin architecture, so we are having other projects which can plugin into the main web application.Right now we are using installshield to deploy our dlls from other projects into the main web application.
How can we do when publishing the main web application as Azure App service.
Is there any feature in Azure so that we can remove the install Sheild and use some properties in Azure to move the dlls from other projects to the main web application folder.
2)We have logging feature enabled so the logs are maintained in local File store under AppData folder and upload the same log file to Db and delete the local log file? How can we achieve the same if moved to Azure App service?
3)Our MVC application calls the another Service application using rest Api calls.Currently we are mentioning the service details in config file under MVC application.
if we are moving to Azure how about the configuration properties mentioned in my MVC Application to call the Service project.
To start with, I would like to deploy my REST Api service project to Azure.My project is a class library and please help how can move my service project to Azure App service and get the server name.
1) Plugin Architecture
We had a similar requirement but we were not using InstallShield for copying plugin DLLs to our web app, instead what we did was created the following folder structure:
-- MVC Application
---- bin
---- App_Plugins
------- Plugin1
------------ Release DLLs
------- Plugin2
------------ Release DLLs
-- Plugins (actual source code)
---- Plugin1
---- Plugin2
and set the output directory of our Plugin 1 and Plugin 2 to point to the ..\App_Plugins\Plugin1\
and we simply published this app directly to Azure Website and that worked like a charm.
Then we found out about CI/CD process on VSTS and that changed everything, it gave us a more elegant way of managing all of this. Can provide more details if you need that.
2 Logging Feature
If all your logging code & logic for moving all this to DB is within the application, then you should not have to worry about anything and it should work without any challenges as long as you setup your DB connections correctly.
3 REST API settings in config file
The web.config file of your MVC application is published along with the rest of your application. so, as long as your settings are mentioned in the web.config and they work locally, it should all work fine in Azure as well.
Start here - https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-deploy
Ensure you already have a Azure account, and of course visual studio has the Azure SDK installed (it may be required).
Related
Can I host a web application created on .net core 2.1 with sql server as database to azure web app service using CI tools / MS WebDeploy?
The following points I want to take care:
The application is using file system for temp storage and file storage
Deployment should be managed by some CI tools such as jenkins
After deployment, the app settings file should be modified with some keys/server details
Log files(stored on app root) should be accessible by application administrator
Is there a way to create a virtual directory same as in IIS and upload the files using FTP or similar protocols..?
All your doubts about deploying .net core 2.1 web app are achievable.
Suppose our projects are all completed and uploaded to github.
Questions and explanations about your concerns:
About the connection configuration using the database, you can directly configure it in web.config. If you are using azure sql server, find the connection string, set up the firewall, and pass the SSMS test, you can test the connection in the code. It can also be added in the Configuration -> Application settings -> Connection strings in the portal. After the addition, the priority is higher than the configuration in web.config, which will override the configuration and not modify the web.config file.
Regarding the use of file storage, you can use azure storage services or not. Looking specifically at the business, for example, very small pictures, documents and other files can be stored in the current program running directory, which is consistent with the original development at the code level. When publishing, you need to include the MyFiles file in the publishing process, or wait for the publishing to be completed and add folders manually in kudu, or the program can judge. It is recommended to use the program to judge that the subsequent program upgrade will not lose data.
The confidential information in the app settings file can actually be configured in web.config or appsetting.json. Make sure that the offline project is running properly when you are debugging locally, and then you can publish it. The rest is configured in the portal as in the first explanation.
The Log Files file storage can fully achieve the effect you want. It should be enough to set the owner permissions of this app services. For details, please refer to the official documentation.
Virtual directories and virtual applications, I have a better answer in another post here, you can refer to it.
Steps:
First of all, we can create a web app in portal and select .net core 2.1. Create appservices, and click Deployment Center when finished.
Follow the prompts step by step, and wait until the Action in github is completed, and the release is successful.
I have a Visual Studio solution that contains two web applications (our main site and our WebAPI project). I am able to host them locally in IIS Express as a single site using the applicationhost.config, but I want to package them (in our Build) and then deploy them (in our Release) as a single site from Visual Studio Online (which hosts our code) to Azure.
My Visual Studio Team Services Build configuration packages each of the Visual Studio projects into its own Web Deploy package. The Web Deploy packaging is done during my Build phase, and the deployment to Azure is done during the Release phase - this is done so I am not recompiling source every time I do a deployment, which is unnecessary and would slow down the process.
The first web application identifies "HelloAzure" as the DeployIisAppPath in its pubxml file. The second one (the WebAPI project) identifies "HelloAzure/api" as the DeployIisAppPath in its pubxml file.
Currently, I am using two of the "Azure Web Site Deployment" steps (the one that uses Service Endpoints to perform a deployment). I name the same web app name for both steps. When the second project is deployed, it seems to overwrite the first one rather than adding a second application to the existing site. I believe I must not be following the intended practice for deploying several Web Deploy packaged applications into one web site from Visual Studio Team Services to Azure, but I can't find the recommended practice documented anywhere.
I do need to have both applications hosted within a single site. Deploying them as separate sites is not an option.
It appears that Kudu has some options that might support this scenario, but I am not deploying from source code, I am deploying from Web Deploy packages created by our Team Services build.
The MSDeployAllTheThings VSTS extension supports deployment to a virtual app in an Azure site.
https://marketplace.visualstudio.com/items?itemName=rschiefer.MSDeployAllTheThings
Microsoft also seems to have added official support for deploying to virtual apps from VSTS to Azure to the AzureRM VSTS extensions according to this thread: https://github.com/Microsoft/vsts-tasks/issues/624
I have more than one web api projects in a single solution file, but when I configure it for continuous integration and automatic deployment it has to be against each project to different web site.
I have created a publish file and provided those details in the MS Builds Build definition file, still it's not taking the specific project to the correct web site.
In order to specify a particular folder from a github etc deployment you can set an environment variable (App Setting) of Project. so if you have a WebAPI1 and WebAPI2 folder, you can create an APP setting
Project = WebAPI1
This will make kudu deploy the correct project.
See the kudu documentation for more information - Customizing deployments
I am trying to get continuous integration configured using Azure. The process I have followed is exactly as detailed by Continuous delivery to Windows Azure using Visual Studio Online
This process works perfectly! I check-in, it builds, and deploys to the Azure website. However, as soon as I add a second web application to the solution, after the CI build kicks off and then completes, the only thing that gets published to the website is the bin directory of the second web application! (Updates to the first project are successful, though)
Given the scenario, I don't understand why the dll's of the second application are being published to the bin directory when the rest of the application(i.e. content files) are not. There is no reference from app1 to app2 so the dll's shouldn't be brought in by reference.
How can I configure this so that it will also publish the second web application?
You can tell Windows Azure Web Sites which project within a repository to deploy using a deployment file.
Add a file called .deployment to the root directory of your repository, with this content:
[config]
project = src/MyApp.Web
You can specify the folder containing the web application, or the actual .csproj or .vbproj file for the application.
If you have two sites in a single solution/repository and you want to publish them both, you will need to use two separate Web Sites, and use App Settings in the portal to specify the project instead. Create the sites, and for each, add a setting called Project in the Configure page, with the path to the directory or project as before.
More info: https://github.com/projectkudu/kudu/wiki/Customizing-deployments (Kudu is the system that actually handles deployments on Azure Web Sites)
While using Github (or anything other than Visual Studio Team Services) I can use the following page to customize deployment: https://github.com/projectkudu/kudu/wiki/Customizing-deployments
I'd like to customize my deployment as I currently have both a web app and a web api project. I want the web app to be deployed, as default it deploys the web api project. Using project Kudu the settings (.deployment file or even better, the app settings on Azure itself) works great, but not when you deploy from Visual Studio Team Services.
I've spoken with David Ebbo from Project Kudu, and he explained that VS Team Services doesn't use Kudu at all, but probably MS Build. So my question is, how to specifically deploy the web app.
I managed to change the Build Definition and specify the web app .csproj as the Projects To Build. This works. However, I also want to deploy my web api.
Deploying the web api project with Kudu is easy as I can create a separate website, connect to the some repository (and solution) and specify the Project App setting so that it deploys the correct .csproj. How should we do this for MS Build? When I change the Build Definition, it will always deploy the project specified in there.
Just saw another answer on Stackoverflow that looks to solve this problem: Publish Multiple Projects to Different Locations on Azure Website