Where do we deploy our dynamic web application? In WebServer or AppServer? - servlets

Let's say we have developed a dynamic web application which includes JSP's, servlets, DB connections etc. In which server do we deploy that application, a web Server or an App Server.

You couldn't deploy a java web-application on web-server.
you have to deploy java web-app to an application server (i.e. Wildfly, TomEE, JBoss EAP) or servlet container.
Now, The actual question arises that if you want directly configure the application server to serve request or configure a web server as a reverse proxy to forward requests to the application server.
Actually, it all depends on your needs. Some question you should ask yourself regarding your project requirements.
Do I need a load balancer to handle?
Do I need better web security?
Deployment of other websites and web application on the same physical server?
if yes, then you should go for a web server like apache HTTPd or Nginx.

Related

Why is hosting outside of IIS termed as self host?

In general, if a third service provider manages the web server for me then it is hosted, while if I am by myself managing the web server then it is self-hosting.
In ASP.NET Core, In both places, I am the one who publishes the code on the server, at the time of IIS it is not called self-hosting? what exactly does "self" means?
For me as a programmer, self-hosting means the application should be able to host itself, which means it must be able to listen to the web requests directly or it must run on its own process. Am I wrong? Please someone help me to understand the meaning of "self" in self-hosting.
Also, the image Microsoft uses to explain self-host is very confusing to me, as far as I know, IIS uses w3wp.exe to execute the application as:
The above image is good, w3wp is the process within that our app executes and IIS is the overall container.
But now, look at this image:
Here the application is the wrapper and Kestrel is within the application and the process (dotnet.exe / application.exe) is the wrapper containing Kestrel, why is it so?
For me, it should be
Why is my image different from Microsoft's image for self-hosting? Where am I missing the concept?
I think that you need to extend the concept:
Hosted is essentially an application (web app) exposed via a third party service that run a server (web server) for you.
Self hosted is the same application exposed via a server managed by you.
Sometimes, as correctly mention by Vineet, self hosted stands for an application with a server process exposing the application itself. Like Kestrel for Blazor.
IIS is not the discriminant for hosted or self-hosted, is just the base of the concept.
From my point of view when I use IIS Express integrated in Visual Studio debug, the application is self hosted and hosted at the same time.
Is hosted in IIS Express from a web server perspective and, at the same time, is self hosted from a service perspective.
Just for information: the applicationName.exe produced by the compiler for Blazor app is just a launcher based on Kestrel. Is a web server that launch the applicationname.dll
An example below from two total different application. The executable (you can open it with a binary editor) is the same.

How to host and deploy an ASP.NET web application on a local server

I have created a small web application with one page only. Now I want to host and deploy this application on one of our business's server so that anyone can access this small app.
Could please anyone tell me what will be the process as I don't have any previous knowledge or experience of doing this also, what changes I do need to make in my web config and the IIS configuration.
Kind Regards
Firstly: Install IIS on the server that you want to host your application on
Secondly: Setup the site in iis
Thirdly: If you have a database connection in your app check that the connection string is updated
Fourthly: Make sure that the relevant port in the firewall is not blocked

Reflecting (or loading dynamically) Asp.NET website from the other server

What would be the best architecture for ASP.NET MVC 4 website that has to be updatable when there is no (maintenance)access to the only server accessible from the Internet?
We have two servers: Server A has Internet access, but where we can't make updates when needed. Server B won't have this problem, but it's behind firewalls and can't be accessed from the Internet.
I have come up with a couple of ideas:
Run Asp.NET site on server B and build simple proxy to server A and tunnel the traffic. (how?) (cf. WCF routing)
Somehow dynamically load almost whole site from server B. It's Ok if the very core of the application can't be changed, as long as every sub application can be. Maybe build some maintenance page what provides action to load newest libraries and files from the server?
Build external updater -software.
Server A is also used by other companies and for example IISRESET is out of question. Application Pool that hosts the application can of course be recycled if needed.
With WPF I would just download the newest binaries and load them dynamically when starting the application, but with Asp.NET and IIS it's a bit more complicated.
Run Asp.NET site on server B and build simple proxy to server A and tunnel the traffic. (how?)
Any HTTP proxy can do this, with a mere handful of clicks or commandline instructions. I wouldn't go any other road.
Maybe try to run on Server A a WCF service, which can copy whole site files from Server B to Server A (I suppose Server B is available from Server A locally). In this scenario Server B is for updating and WCF service is only for deploying.

How to embed an asp.net site in a windows service (or vice versa)

I'm building a windows service but I would like to get some web pages to control some settings, get diagnostics, etc...
How would you go about combining an asp.net web site AND a windows service together ?
I know that WCF can be self hosted into an arbitrary process but can I do the same with asp.net ?
Another option would be to have my service logic in the asp.net web site application_start method to spawn long running threads. But then, I don't get window service built in feature such as auto start on boot up. Another issue might be that IIS might decide to recycle the process. Moreover, my service needs to open a raw tcp socket to accept connections. Can I do that in IIS ?
Thanks
I think the easiest and most robust way to do this is to have an ASP.NET Web Site running under IIS on the same server as the Windows Service. The Windows Service can host a WCF Web Service that will be accessible to the ASP.NET application.
I would have your Windows service self-host a WCF "configuration" service. The WCF service only needs to be exposed locally if the UI is on the same machine. If the windows service needs to open a separate raw socket for communications this can punch a hole through the firewall.
Then the ASP.NET UI can be hosted by IIS as usual, and call the WCF methods to perform the configuration tasks.
It seems like you really need both thingsā€”a web app hosted in IIS and a windows service hosted as windows service.
Then you can just share data between the two in some way, e.g. via a database.

Can a .NET web application be host on dedicated linux server with static IP and run this web app as a web site?

I am working on a project which is a web based in which it has three different modules. For this whole project I am using a dedicated server with static IP which is a linux server with MySQL as a database.
Now my query is, in my project I am using a web and desktop application which connects to my server. Now my web application is integrated with my company website which is done in .NET
Is it possible to host my website in my dedicated server which is a linux version?
Could some one tell me which is the best way to run my whole project in a better way.
Thank you.
You can access a remote MySQL server instance from your .NET application, you need to ensure that any network routing and firewall rules let you through. You must ensure that the application server can reach the MySQL server on the 'listening' port (probably 3306).
Ideally you will have both the database server and application server in close proximity and on the same local network, otherwise there is no problem in this hosting architecture at all. Web applications and databases often require different tuning optimisations and for redundancy purposes it is also good practice to separate them out. Of course, you only have redundancy if you have more than one application server and more than one database server.

Resources