Deploying ASP.Net application to two Windows servers - asp.net

I've got this Asp.Net MVC App I would like to deploy to my two servers running Windows Server 2012. Actually I've got two servers on which I would like the application to run. Only one server is used at some point in time and the second is just a copy of the first. Both servers must be in the exactly same state at any time so that when one of them is broken, I could redirect users to the second without them noticing any change.
Question:
How to sync the application on both servers to avoid having different states from one server to the other?

Check this ARR setup configuration in IIS
https://www.iis.net/downloads/microsoft/application-request-routing

Related

IIS 8 publish ASP.NET core application - file in use

Is it possible to publish an ASP.NET (core) application to a running site on IIS 8 without having to stop and start the website manually?
Visual Studio 2015 keeps giving the error that a file is in use. I'm using publish to the file system, because my Web Deploy to a server in our network fails at the end with an error that it cannot authenticate on the server with port 443.
I don't mind IIS having to recycle the application pool, but when I constantly have to put the app down, publish (which takes about a minute) and restart it, it's not really good for the users.
Another option would be something like 2 websites running the same application, but only if this is automatable. Then it would put down 1 of the 2, update this, put it on, put down the second, update this and start it.
A third option is something like a hot update, where I could just update the application while it being on.
Can anyone point me in the right direction (perhaps some blog posts), because my Google searches didn't give me any good information?
If you copy a file called app_offline.htm to the application folder IIS will gracefully stop your application and start serving the contents of the app_offline.htm file. When application is stopped you can copy your files. After files are copied remove the app_offline.htm file and IIS will start your app. VS does that for you when you deploy to Azure but not when deploying to file system.
You mention "two websites running the same application". Do you mean two web servers hosting the same app?
If you already have multiple web servers (a.k.a. cluster of servers, or web farm), you can simply take some servers out of the cluster and update them. That is how we push out our updates. We use software from Citrix for managing the server farm. It also handles load balancing. This type of software allows one to monitor the servers, so you can determine when all the users have "moved" off the web servers (that were recently taken out of cluster). Then you can iisreset, deploy the new build, and move on to the next server (or set of servers, depending on your configuration). We have more than 20 virtual web servers. Typically we take down half of the servers, update them, and take the other half down as we put the first half back in the cluster/farm. This should allow for uninterrupted service. I understand you want to automate the process. I'll assume you're using Windows NLB (network load balancing). You could write a PowerShell script to automate taking down the servers. Here's a reference:
https://technet.microsoft.com/en-us/library/ee817138
I understand this may be viewed as a workaround. I'm not sure if recycling the app pool is always necessary with ASP.NET Core. I wasn't able to find a definitive answer. Most production applications should be on more than one web server anyway. Even if you don't have a lot of users, you should have multiple web servers for failover purposes.

How to host multiple WebSites on same IP and Port in IIS 7?

I'm working asp.net web based application, I have deployed this application on server, Its getting response on port 80 from a outside client. I want the to fix the bugs so I want to run this application in Debug mode so that I can attach the worker process with the application and this is making the Performance down and its disturbing the QA team. So can I have two application one can run in release mode so that QA activity does not get disturbed and parallelly I can debug the build and fix the bugs or can do further development. I'm facing the same problem during the development activity, If multiple developers are working paralley , only one is able to debug the application other one has to wait. So please suggest me, If I can get rid of this situation.
I have only one server on which I can test this application.
So My requirement is how to host multiple websites on single ip and port.

Synchronizing the IIS 7 across two app servers

I am using the Shared IIS feature of IIS7 i have taken the config files of one server and put it in a shared location..in the second server i m using these config file from the shared location.I am able to synchronize this but the issue is whenever i m adding a new application in the IIS server of first server the other server doesn't show the latest application...in the second server i am just able to see the Virtual directory and not the application.
Can any1 help me on synchronising the two servers i.e when i add any new application in first server the other server should automatically show the changes.
My business requirement requires runtime generation of the applications in the IIS(which i have completed) the only problem is synchronisation.
Thanks,
Sajesh Nambiar
You need MS WebDeploy to do this implicitly.
http://www.iis.net/download/WebDeploy

How to persist connections during code update in ASP.NET MVC

When one updates an ASP.NET MVC app in IIS the framework keeps the connections open. All responses to the connections are sent once IIS has caught up. Unfortunately this can take some time (eg. 15 seconds). Is there any way to update part of the app without affecting connections to another part.
An example use case: if you have a web chat app and you want to make a minor change to one section of the website, can it be done without 'pausing' the connections to the chat app.
If you can physically separate the code into its own folder, I.E. (c:/inetpub/wwwroot/myapp and then c:/inetpub/wwwroot/myapp/chatapp), you could define "chatapp" as its own application within the IIS website, and then create a new application pool just for that application. I had to do this before because the project I was running needed to have part of the IIS site on a different recycle schedule due to performance issues, also it crashed a lot so it was advantageous for it to have its own process so it didn't take everything else down with it :)

What exactly is the App Pool?

Ok so I understand how app pools work and what they do but I am wondering what exactly the app pool is, I am thinking at the moment that it is just information the metabase or some config file for use with http.sys?
I suppose another questions is, who or what spawns the worker process when a request is made?
thanks
The confused
First you can see the application pool as the program that actually is one with your pages and runs them. So what ever you make programmatically on your pages are done using the application pool.
For example:
user request the page a.aspx
IIS see that is asp.net page and assign it to one app pool
application pool see the a.aspx, check if is complied, and runs it - run your code.
Second you can see the big view, that there are many web sites lives together on one server and application pool is handle one or more web sites together.
Now, a web application can be run on one application pool, or on many application pools at the same time on the same server (this is called web garden). An in each of that you can run many threads.
Now for more details you can read the official microsoft pages.

Resources