Blazor Wasm - Publish 'lifecycle' - asp.net-core

I have an active Blazor Wasm - Core Hosted site that is being used by one entity at the moment. Whenever I perform an update I wait until they're not using it (perhaps for no good reason).
Going forward, I'd hope to have multiple users and there will not be a common window where the site is not in use. Am sure this is not a unique requirement, so am pretty sure that its all covered under the hood, but if you can answer the following it would help clarify for me.
When a client connects to server the application is downloaded to client ...
Is this done by the script "_framework/blazor.webassembly.js"?
If I publish an update to my site at my hosting site whilst the application is in use ...
Am I right to assume that the application pool running in memory will
persist until I force a 'recycle'?
Does this mean that my published code will have no effect until the
pool is recycled? Or do new connections get the new app?
If I force a recycle whilst there are active users, might I not end up
with a downloaded client app that is out of sync with the running
server app?

Related

How do I deploy an Asp.Net Core app on a web farm?

Currently we have 4 separate IIS servers all running behind an HA Proxy load balancer. With Traditional ASP .Net, we've been taking a web deploy package and loading them to the first server, and then just using MSDeploy to sync all of the servers to the first. Almost all of our deploys are virtual directories, not web sites. And those virtual directories are assigned to an established app pool. This has been working well for some time now. For those rare times where we need to create a new application pool, we log into each web server independently and create the app pool. These app pools run a specific set of credentials.
With an ASP .Net core app, it seems there are 2 different issues now to address:
Since Kestrel fires up, how do we get the kestrel part of the
virtual directories to shut off so we can sync the servers up. We
really don't want to have to log into each server independently to
shut them down.
It seems that the preferred method is to create
an individual app pool for every ASP .Net Core app. In our case, on
our current environment, if everybody started rewriting their apps
in ASP .Net Core, we've have about 200 app pools (and growing). It
isn't possible for one giant app with all of the virtual directories
in it. They are managed by different teams. So is there a way to
sync the app pools (with a specific set of credentials) across
servers in a farm?
Thanks,
Nick

Is it possible to run ASP.NET 5 site directly on Kestrel in Azure WebApps?

I have checked that in the web response the server is IIS when I deploy ASP.NET5 to azure web app, so I guess the IIS platform handler is used to redirect it to Kestrel. So I am wondering if it is possible to run directly on Kestrel, and what benefits/drawbacks will that have (probably regardless if it's in Azure or not). I suppose it will be a bit faster since IIS will be excluded from the pipline, but it should not be too much overhead I suppose...
On Azure Web App, you cannot bypass IIS.
But in the general case, you can definitely run Kestrel directly. It is after all just dnx web and it's exactly what the XPlat version (Linux, OSX) will end-up using (almost).
What you lose from not using IIS
Security (newer component compared to IIS)
Easy setup of SSL
Kernel module that handle file/cache and other things (kernel = faster)
Application monitoring/Keep-Alive (what happens if Kestrel crash)
Multiple hostnames single-port (80) reuse
etc.
What you gain from not using IIS
Complete control over your process
Higher overall performance
Simpler installation/execution
What you should do if you choose not to use IIS
If you are OK with the "lose" points, I would still go and host your Kestrel behind a reverse proxy or an NGINX server. Kestrel was made to be "production ready" but it's not NGINX or IIS.
It will not keep itself alive as far as I know.
If I missed anything, please let me know.
Your question is a bit ambiguous, as it asks at the same time about Azure Web Apps and about the general case. #Maxime answered the general part, so I'll answer the Azure Web App part.
It is not possible to bypass IIS in Azure Web Apps. Stack that normally run without IIS are typically handled using HttpPlatformHandler (as is the case for ASP.NET 5), or in the case of Node some variant of that (iisnode).

Hosting a continuosly running Console application

Azure VM, Cloud service or Web job?
I have a configurable console application which runs continuosly. Currently it is running on a VM and consumes lot of memory (it is basically doing data mining).
The current requirement is to have multiple instances of this application with different set of configuration which can be changed by specific users.
So where should I host this application such that the configuration can be modified using some front end which provides access managements(like Sharepoint),ability to stop it/restart (like WCF service) without logging on the VM?
I am open to any suggestions/ideas. Thanks
I don't think there's any sold answer to this question as there is the preference variable but for what it's worth, if it were up to me I would deploy it against individual azure VM's for each specific set of users. That way if the server resources went up because of config changes the user group made it is isolated to that group, and with azure, will scale automatically to meet the resource demand. Then just build a little .net web app to allow user to authenticate and change configuration settings.
You could expose an "admin" endpoint for your service (obviously you need authentication here!) that:
1. can return the current configuration
2. accept new configuration
3. restart the service (if needed). Stopping the service will be harder, since that leaves the question on how to start it again.
Then you need to write your own (or use a 3-party (like sharepoint or a CMS)) application that will handle your users and under the hood consume your "admin" endpoint.
Edit: The hosting part: If I understand you correctly your app is just an console application today, and you don't know how to host it? Well, there are many answers to that question. If you have a operations department go talk to them, if you are on your own play around and see what fits you and your environment best!
My tip: go for a http/https protocol/interface - just because there are many web host out there, and you can easy find tools for that protocol. if you are on the .NET platform check out Web.API or OWASP
Azure now has Machine learning to process data mining.
You should check if it's suit to you.
Otherwise, you can use Webjob:
Allow you to have multiple instances of your long time running job (Webjon scaling out).
AppSettings can be change from the Azure Portal or using the Azure Management API

How to run a WCFservice automatically on windows startup

I have an developed a mobile application which makes use of the WCFservices..
DETAILS OF MY APP AND WCF-SERVICE :
My app has an hierarchial workflow..it has various levels of users..requests and queries are raised from users which travels up the hierarchy for approval..Here my WCFService serves the purpose of fetching,filling and saving the requests and queries from and to the database server.
NOW HERE IS MY ACTUAL NEED :
The WCFService must start automatically on the system boot up, so that my app starts to get notifications if there are any new requests or queries for approval.
So how do i make my service to run automaticaly when the system starts up ??? can u pls guide me through the steps ??
Any service posted on IIS will start automatically because on windows startup the IIs loads automatically
You should host it using windows service. Here is one example of a link that could help you.

How to: Avoiding Cold-Start issues with IIS hosted WCF applications?

We have a system where we host a couple of WCF applications in IIS. Some of these applications have a bit of an extended start-up time taking a couple of seconds (more than a users would be happy to wait for). Once it's up and running, everything is snappy though, so it really is only the startup time.
The client also has a requirement to recycle the application pools every night.
Is there some way to wake all these services up so that the start-up time is not an issue for the first user of the system?
Initial thoughts where to write a windows service that would simply call a lightweight method on each service every x (configurable) minutes to keep the apps alive, but since we are in a load balanced environment, and the applications need specific host headers to be passed, we would always hit the load balance address which means there is no way for us to make sure that all services on all boxes in the cluster are actually started.
Since a single wcf application in IIS can only have a single host header, the only other way would be to setup a second iis web site pointing at the same application. I'm just not sure if that would do the trick since it would be in another host context.
another option could be to wright something like an extension to IIS (not sure if this is possible yet) that could call each of our services when IIS or the app pool actually starts up again. (Something that notices when the app pool has recycled but before the first user request.
Any ideas would be much appreciated.
Thanks
Gineer
Excellent. Thanks Dercsár.
After a quick Google, I found the following arcticle on the subject: Using the IIS Application Warm-Up Module
The limitations here are that this is only available on Windows 2008 R2 with IIS 7.5. Although our client is in the process of upgrading to Win 2K8R2, this may still be some time off.
Does anyone know of a solution that would work for Windows 2003 with IIS 6 or will we have to write something do make this work?
Gineer
For those of us running on a version of IIS before 7.5, we are in the process of testing the following solution...
As mentioned in the original post, the initial idea was to fire off a WebRequest from a service running on each machine to the local web sites (which host the WCF services), but this would be impossible, since they all make use of Host headers, and they all live in a Network load balanced farm.
We then thought that we could simply provide the custom host headers in the web request to the localhost.
Turns out you can not update the host header name in a WebRequest. It’s a Read only field.
Messing with a proxy class makes it work though.
See: http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/1b35c665-fe32-4433-8877-a62f2d400a8e/
And a short piece of my test code below in C#.
WebRequest req = WebRequest.Create("<Correct Host name>");
req.Proxy = new WebProxy("127.0.0.1");
StreamReader stream = new StreamReader(
req.GetResponse().GetResponseStream());
StringBuilder sb = new StringBuilder();
String LineString;
while ((LineString = stream.ReadLine()) != null)
{
if (LineString.Length > 0)
sb.Append(LineString);
}
stream.Close();
String response = sb.ToString();
This may not be what the proxy class was intended for, but it seems to work either way.
Gineer
Ps. No, you do not need to have any actual proxy server installed on the local host machine.