Setup for ASP.NET web application - asp.net

We have some ASP.NET web application which used in 2 ways:
enterprise solution (msi-like installer)
cloud solution (use same installer)
Currently we use home-grown installer, but consider if we can replace it with something more convenient and suitable for CI/CD development cycle.
What technologies/products can be used? Currently I think about webdeploy, but not sure how it can be applied for enterprise setup...

This is quite a broad question, but I think it deserves an answer.
1. (partially) Open source solution
One way to configure CI cycle is to use Jenkins along with MS deployment functionality. This article shows how to quickly set up a job to integrate Jenkins with msdeploy tool.
Basically it configures a job to perform the deployment using Powershell:
msdeploy.exe -allowUntrusted=true -verb:sync -source:contentpath='D:\WS\ExampleProject' -dest:contentpath=F:\webfolder,computerName=exampleproject.example.com,Username='yourdomain\username',Password='password' -skip:objectName=dirPath,absolutePath="config" -skip:objectName=filePath,absolutePath="web.config"
It also tells that the executing user should be an administrator on target server, but this can be circumvented through proper configuration of Web Deployment Handler as indicated in this article.
One intermediary step that can be done before Jenkins integration (which I recommend) is to configure Web deployment. This allows to quickly check that deployment can be performed onto target server IIS using Visual Studio and any configured user that is allowed to deploy. It also allows to quickly see the difference between current code base (web pages, JS files, binaries) and target server deployed package.
2. Visual Studio 2017 DevOps solution
Microsoft recently released VS 2017 which contains a great support for DevOps which handles most the issues related to CI/CD. I cannot find a reference, but I remember that this feature is available for Enterprise version only. Also, the good news is that it is not tightened to Microsoft technologies.
A presentation related to the subject can be found here.
I think WebDeploy can be used without significant problems. From my experience with it:
backup limitation: can be done only at Web Site level, not Web application level
deployment time: is quite small - actual files copy + Web site backup (if configured) + application pool recycle.

Recently I saw a vendor offering customers who wanted on-premises deployments the same Docker image that they use for cloud deployments. Seemed like a good, clean, solution.
Another option is nuget packages - host your own repository. Then deploy with a tool like Octopus Deploy. I'm not terribly familiar with it, but both solutions look to be easy after an initial hump in setup.

Related

.NET Core in Visual Studio 2019 - Desktop deployment options

I tried searching for deployment methods but the results I was seeing are way to general and meaningless to be useful. Maybe there are some keywords I am missing to find what I am searching for?
I have an .NET Core application and need to push it out to many computers throughout the organization. I also need to be able to push out updates to the application periodically.
Its my understanding that this can be done through Azure but I need to know of any locally contained options that don't rely on internet connections but would work within our local network.
What could I search for to pull up lists of products and/or solutions to achieve something like this?
You can use tools like Teamcity, Jenkins or Octopus. Once installed, it runs on localhost and the build definition can be created to execute periodically. Also, you will be able to add your changes incrementally while planning for new builds.
For TeamCity I recommend the following link -
deploying .NET Core app on TeamCity
For Jenkins and Octopus I came across following -
deployment using Jenkins
deployment using Octopus and Jenkins

Web site deployment software

I work for a company that has a multi tier web site. So we have several front end sites talking to several back end web services. All this is load balanced across several servers and hosted in IIS 6.0.
When we do a new release we need to copy several sites from a staging environment onto a pre live version on the live web servers. The number and types of sites deployed in any release could vary. Currently use robocopy scripts/bat files to do this. Which works but is prone to errors and is difficult to maintain.
Does anyone have any experience of some good, preferably open source, deployment software which may aid us in this task?
I would use PowerShell and its WebAdministration module. Also have a look at Scott Hanselman's article here, where he explains the WebDeploy packaging and deployment solution (on Channel9 also).
We use a continuous integration server and Web Deploy. The only manual steps are triggering the build in the CI server.
We use TeamCity, which has a limited free version. CruiseControl.NET is an open source CI server, but the configuration isn't nearly as nice as TeamCity.
Here are a few articles on setting up TeamCity for deployment:
http://www.diaryofaninja.com/blog/2010/05/09/automated-site-deployments-with-teamcity-deployment-projects-amp-svn
http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity_26.html

What is a good way to deploy ASP.NET MVC applications to IIS?

My team works on a couple of ASP.NET MVC 2 applications, hosted on IIS 7 with an Oracle database. We do our database migrations manually and publish our projects directly to the web servers using Publish to File System in Visual Studio 2010.
Are there any best practices on how to release to test, stage and production environments directly from TFS? We would love to be able to automate our releases completely, including database migration scripts.
The preferred way to perform deployments these days seems to be WebDeploy. I believe this can be integrated into TFS, although we don't use TFS so no experience with this yet. WebDeploy is fully extendable with it's provider model.
You could use WebDeploy as a build task like TheCodeKing says. It works fine, we do it in our project and deploy to a dev-server and a test-server like that. The build definitions are available in the VS Team Explorer and every team member can push a build to Dev or Test.
For the database you could use the Data Dude features (or another schema compare tool) and run it via a TFS Build task (TFS 2010 supports database projects) or via the command line to compare and upgrade the database. This is of course dependent on you using the database projects.
Yes you will use web deploy for details information and step by step guide see the following post
http://mohamedradwan.wordpress.com/2010/10/23/auto-deploy-your-website-for-qa-with-team-build/
Thanks
M.Radwan

How does running ASP.Net on Linux compare to the standard Microsoft-centric solution?

I know its possible to develop and host an ASP.Net site on Linux using Mono and Apache, but I'd like to know how well it works and if its worth the hassle? I prefer open source, but for this project I want the quickest, easiest, most reliable solution.
The site I'll be building will be a fairly basic ASP.Net site using MySQL.
I'd like to know if anyone else has experience using Mono in a situation like mine and how the project went. How did it compare to using a Microsoft-centric solution?
I know Mono is still somewhat incomplete, but I'm hoping I won't need the features it lacks.
This question may be a bit "polarizing". Most similar questions seem to have responses from people who are either very pro-Microsoft or pro-Linux. I'm hoping for some unbiased responses, preferably from people with experience using both.
I switched from MS-centric solutions about a year and a half ago and now I'm hosting all of my websites and web projects on Linux/Mono/Apache/MySQL based virtual servers (I was originally using nginx instead of apache, but mono-fastcgi-server was randomly causing thrashing, so I choose apache as a web server). I can summarize my (subjective) experience with this configuration into a few points:
It can take some time to get used to difference between Linux and MS based environments (if you never used Linux before), but I do not regret this decision. What helped me a lot was creating installation and configuration procedures for particular technologies (for example mono parallel environments, apache virtual hosts configurations, dealing with certain issues) which are mostly repeatable and can be automated.
You can still use Visual Studio to develop your applications and then deploy them on Linux machine. If you are using this approach it's a good habit to test your apps regularly on mono for possible incompatibilities.
I deploy web applications via FTP which is probably the easiest way of doing it (well maybe WinSCP is even easier, because you don't have to set up FTP server, but it depends on your preferences).
So far I have run into 2 cases with Mono/Apache where memory leak caused unavailability of the website. This was probably caused by Boehm garbage collector which I was using on old mono installation. I haven't had similar problems with a new sgen GC on recent versions of mono.
What I like the most on mono running on Linux environment compared to MS stuff is that you don't have to click around all the time when doing administrative tasks. Shell is for me unified administrative interface which can speed up things (if you have some practice).
Hosting ASP.NET on mono from my experience is quite easy and fast. i has been host multiple of my project using Mono ASP.NET MVC 1 / 2 using MySQL and PostgreSQL, serve by Apache mod_mono.
Compared with deployment on Windows Server. It quite narrow when using modern linux distribution which already provides all package to deploy mono ASP.NET. the only drawback is you have to make sure your Web Application portable enough in term of IO accessing and only very short learning curve and experience needed to debug and publish your project.
For Deploying our project in Linux. It easy using Version Control (VS) such as Mercurial or Git if u have fully control on the server. If U have more experience using continues integration is more better. I mainly using mercurial so step bellow is the step i usually do, but i think it almost similar for Git:
Install mercurial, and configure mod_wsgi, hgweb.wsgi and hgwerb.config
Init VS repo and publish at hgweb.config and configure hook to update and invoke xbuild to automatically build when u push it
publish the repo (web part) as mono application at mod_mono.conf
So u just need to code at visual studio, commit and push your changes using tortoiseHg without event login to server (set repo url, user and password at your repo hgrc)
Please note that although you can deploy ASP on Linux via things like Mono, if you use a Microsoft ide such as Visual studio, webmatrix, or Visual web developer your licence only allows you to deploy these on Microsoft servers!

Does Microsoft offer an automated tool for App Deployment?

Does Microsoft offer a tool where you can deploy a web application to multiple web servers in a load-balanced environment/web farm?
My team is looking for a tool, preferably from Microsoft, where we can deploy our web application from development environment to production environment automatically.
If I understanding what your asking for your looking for a build server, to my knowledge Microsoft don't offer one, but some to take a look at are Team City, Hudson(requires a plug-in), and CruiseControl.net.
Basically they work by pulling from your source control building your application and running your tests. They all support scripting that will allow you to build then deploy to your servers. This can be set up to run nightly, weekly, etc. you can also set it up to monitor your source control for changes and build anytime it sees a change
The only one I've used is Team City, the install was easy, and depending on how many build agents you need it's free.
If your just looking to build and deploy from VS Another option is creating an NAnt script and running it from VS as an external tool.
For a good over view of Build servers check out this SOF question cruisecontrol.net vs teamcity for continuous integration
The Web Deployment Team blog at Microsoft has some reasonably useful information, and have a deployment tool you could try...
In the last environment we setup we used TeamCity for all our builds and deployments (Which is basically to say we wrote MSBuild scripts and automated them with TeamCity). In short we had the following 5 build configurations:
Continuous Build - Automatically rebuilt our product upon every check-in. Running all the tests. This build did not deploy anywhere
Nightly Build (Dev) - Automatically build and deployed our product to the development web server (no server farm). We build would run the tests, update the development database, shutdown the Dev IIS web site, copy the necessary files to our web server, and restart the site
Test Build - Like our Nightly build only it deployed to our test environment and it wasn't scheduled so it had to be manually started by logging into Team City and pressing a button
Stage Build - Like test only deployed to a web server that was externally visible to our customers sot that they could validate the application. Also, only run on demand.
Production - Created a zip file of our product that the deployment team could install on our production web servers
So I guess what I'm suggesting is that you use TeamCity and then write build scripts in such a way that they'll deploy to your Web Farm. If you want examples I could supply you with the pertinent portions of our build scripts
** One more thing: we check in our web.config files and such for each environment into subversion and then part of the build process is to copy and rename the appropriate config file for the environment. For example, web.prod.config => web.config in our production build
I believe that Sharepoint does this.
File Replication Service ( e.g. DFS Replication ) is a typical and very good choice for doing this.
Your changes are synced between member servers at the file system level.
Sharepoint does this automatically when you deploy a solution package.

Resources