AWS Load Balancer and IIS Virtual Directory - asp.net

I am migrating a project to the cloud with the aim to load-balance the website.
It is currently .NET Core app hosted on IIS, but there is a Virtual Application attached to this site in IIS (for a very old MVC3 application):
www.mysite.com hits the .NET Core app
But
www.mysite.com/blog hits the completely separate MVC app.
I want to dockerise my application and run it behind Elastic Beanstalk, or even just some EC2 instances behind a load balancer, but how can I take care of the "blog" app in this scenario? It 100% doesn't need to be load balanced and I don't want to make it part of the deployment strategy, since it is a simple CMS and the code hasn't been re-deployed for years!
EDIT: I'm thinking the Load Balancer provided by AWS must be the thing I am looking for, since it will be linked to the DNS entry and as it is effectively a reverse proxy, I should be looking to see if I can configure the Load Balancer to add a rule to reverse proxy the request into one of my EC2 boxes?

how can I take care of the "blog" app in this scenario?
You can use Application Load Balancer. You can have different listeners handling different URLs (e.g. one listener handles www.mysite.com and another one handles /blog).
You can add more sophisticated rules for /blog to forward its handling to different target groups.
Target groups can contain ECS, EC2 and whatever you need.

Related

Route traffic to particular server based on URL path on ElasticBeanstalk

This is just an idea in the making right now so no specifics but, I am wondering what the best way to route traffic to a particular server for URLs with the path /post*?
I am running a WordPress/WooCommerce install on ElasticBeanstalk which is all setup already but I am thinking of adding a blog to the site. This would all be under the same application and deployment etc (so normal WP site really, just write a post and publish on the same site) but I want to ensure users viewing the blog area of the site don't consume resources for the eCommerce side.
If the blog runs slow at a given time this is not a huge issue but the eCommerce side shouldn't be hindered by a spike in CPU for example.
My initial thought is to have a separate EC2 that accepts traffic to all blog related paths but how could this link into git/application deployments via AWS etc? Maybe there is an easier approach I'm missing?
The current setup is basically the below:
CloudFlare for DNS
WP on ElasticBeanstalk with autoscaling/loadbalancer
AL2 with NGINX
Worker application for background task (no webserver) also ELB
Shared RDS instance for DB
EFS for ephemeral storage
S3 for storage
You can't do this as a single Elastic Beanstalk deployment. Elastic Beanstalk is for running a single app. You would need to have a 2nd Elastic Beanstalk deployment for your blog application. You would configure path routing rules in Cloudflare to forward requests to /blog/* to the new server.

Deploy multiple Web Site to one Azure service

I am new to windows azure. I have requirement that I have to achieve. I have searched on the google but it was not useful.
I have to deploy multiple web sites to 1 cloud service. Is there any possibility? I will make them ssl enabled with multiple certificates in one cloud service.
So url's will be like:
https:// mysite/Home/
https:// mysite2/Home/
https:// mysite3/Home/
Actually my requirement is I should be able to deploy multiple web site and able to change the web.config after deployment. I think this we can do by enabling remote machine to the cloud service. After that we can login to remote machine and change the web.config file through iis manager. Am I correct?
Do we have any best way to achieve the requirement? I have to consider the minimum cost for this.
Thanks
This is an old post, but it shows how to run multiple websites in the same web role: http://www.wadewegner.com/2011/02/running-multiple-websites-in-a-windows-azure-web-role/
Regarding the changes in the web.config, you should not do that, because your instances may be changed, and those new instances will not have the modified file. All the configuration you are willing to change after deployment should be stored in the ServiceConfiguration.cscfg file. This way you can modify the configuration without redeploying, and the configuration is shared among all instances of the service.

Two instances of the same Website on IIS with different web.config (two different databases)

I want to implement some kind of a configuration of the same website (www.example.com) so on IIS I want to have two instances with two application pools so one instance located at:
c:\Site1
And the second one located at
c:\Site2
both sites are 100% equal with the only exception of the database connection string, each one is pointing to a different database server.
So in the DNS will be pointing to www.example.com and on IIS each instance will point to www.example.com.
I'm doing this way because I need to restore the database daily with new information so in my current scenario I have to stop the application, restore the database and then restart the application so the website goes offline every time I do this.
So I was thinking to do something this way so I can stop Site1 then restore the database then restart the site and do the same for the Site2
Rather than duplicate the websites, you can have two databases e.g. DB1 and DB2.
If DB1 is active (configured in web.config), restore to DB2. Then, update web.config to point to DB2. Currently active requests will complete using the old configuration (pointing to DB1), but all new requests will use the new configuration (pointing to DB2).
UPDATE
Based on your heavy startup cost, you can instead create the two websites as www1.example.com and www2.example.com, and setup a third site as www.example.com that simply redirects to either www1 or www2 depending on which one is ready. You can configure the redirection within IIS, no need for an html or ASP.Net page to accomplish the redirect.

web services on a dedicated port within an ASP.net web site

Is it possible to have a web service within an ASP.NET forms web site run on a different port, sort of like how SSL has a dedicated port?
The service needs to see the app_code folder in the existing site and of course app_data.
Any links to articles or tutorials would be greatly appreciated.
You can have several different ports bound to a website in IIS, however if you bind that port, it will work on the whole website. You can't bind a port specifically to a directory within a site.
So you can have a secondary port (ex: 8080) added along with a hostname through the website bindings in IIS.
If you don't want to have the rest of the site (that's not the web service) to respond to the secondary port, you would have to do it through either code, or configuration.

Error attempting to access a web service (hosted locally or externally), can't resolve host name

I'm stumped. I've got an asp.net mvc app being hosted on a shared hosting provider. The configuration of their system leaves a little to be desired, but it's cheap (getting what I pay for I suppose...)
The problem is this: The application is hosted at the root level of the hosting account. I have a virtual directory established underneath the root that is running a .net 2.0 web app along with a web service. I can access the web service directly via the domain/subdirectory url. The main web app (at the root level) needs access to the web service in the virtual (subdirectory). Locally in development, I can run the app against the web service out on the hosting server and it runs just fine. When I push the web app up to the root of the hosting service, I get "The remote name could not be resolved: ".
At first I thought the error was related to the DNS settings of the primary domain since both the web app and web service technically live at the same domain. As part of just trying to get something working, I reverted the web app to reference an older version of the web service on a different server (different host altogether). Again, it works fine locally. When I push the updated web app, I got the same error, but noticed the host name referenced is that of the external domain. Of course, I can access the web service via the browser just fine.
Sorry if this doesn't make total sense... it's late and I'm beat from looking at this for the last few hours. Any help would be greatly appreciated.
EDIT
So the web app simply has a Web Reference to the web service (I could probably just restructure the app avoiding the web service altogether, but time is of the essence [for now]). Since I got stuck last night, I pointed the web reference back to an old server but the issue remains. Right now the url the web reference points to is http://road34.hi-fisoftware.com/webservices/giigsterservice.asmx.
If the server has a firewall then and an external ip and different internal ip then probably you will not be able to access the webservice with the domain name. you will need to access it as internal url or as relative url.

Resources