Multiple ASP.NET Web API on the same IIS - iis

I need to create 3 separate and independent versions of my ASP.NET WEB API and host them all at the same port and in the same IIS.
So, let's assume that my current API runs at:
http://xxx.xxx.xxx.xxx/api
I need to replicate it to
xxx.xxx.xxx.xxx/test/api
xxx.xxx.xxx.xxx/dev/api
but it is very important that each one will have it's own configuration on IIS.
The reason for that is that I want each "version" of the API to have a different connection string.
Of course this will have to be done with out any change in my current code, just via IIS setup.

You can create applications under an IIS site to accomplish this. You can even use WebDeploy to deploy them all. Follow this blog post -
http://dotnetcatch.com/2016/03/03/simple-service-versioning-with-webdeploy/

Related

Consul and IIS hosted applications

I'm trying to to use Consul to implement service discovery in a microservice architecture.
I've tried to setup my dotnet core 3.1 application to self register with Consul, and I have 3 VM's running Consul, automatically picking a leader of the 3.
Reading numerous examples online, they all have one thing in common: I need to know the URL of my microservice. Now, using IIS I have 2 options when it comes to hosting; Sites and applications. Sites have a certain URL connected to them (Example: http://api.microservice1.com) whereas application use the servername in the URL (Example: http://webappserver1/microservice1).
As I have 2 servers (Let's say webapp01 and webapp02) I can't know what server the service is running on, and therefore I can't seem to find a solution as to using IIS applications instead of IIS sites. My service would be one of the following routes:
http://webapp01/microservice1
http://webapp02/microservice1
Is there a way for me to use IIS applications and not sites? How would I register my microservice with Consul? Perhaps I'm just forced to use IIS sites and not applications?

How to use same custom domain for Web app hosted on Azure and web application hosted on window's IIS server?

I have a application which is hosted in IIS on window server and application URL is "www.hire.com/jobborad". Now i am going to add new feature(sub application) for example "Candidate Hub" so
I am planning to created separate code-base and host that application in Azure as Web App but i want to use the same parent domain of my original application. my sub application's URL will be a "www.hire.com/CandidateHub".
Is there any way that even if my application hosted in differently environment, I will be able to use same domain?If yes then could you please recommend me any tutorial, blog or any thing which help me to resolve my problem.
I search a lot on google but nothing find useful.
Thanks in-advance for help.
Note : Mentioned URLs are just for example. Those are not exist.
this is usually done with the URL Rewrite Module in IIS.
Don't be surprised that the docs are quite old. They are still valid for latest Win Server and IIS.
for external routing you also may need the ARR feature which should be downloaded via the Web Platform Installer.

How to synchronize more than one IIS web servers

I have a .net web application, I want to host the app into more than one IIS web servers. The web servers must synchronized so if one web server is down than the others should respond to user requests.
Check out tools like:
gtg.dk
deploybot.com
Check out also deployplace it is very similar to DeployBot, but much more powerful and allows to deploy complicated application. It's still in beta, but there is a free plan.

How combine 2 web apps under one domain

I have 2 ASP.NET core projects, first one lets call it Test which contains angular SPA, and the second one Test.API which exposes a RESTfull API to the angular app, now i'm deploying 2 apps to Azure web apps under custom domain.
Test is: www.mydomain.com
Test.API is api.mydomain.com
My problems is that any call from my angular app causing an additional OPTIONS request (delay) that i want to eliminate, by rewriting request (Not redirect) that points to api.mydomain.com/* to www.mydomain.com/api/*.
And also keeping 2 different web apps.
Tried to use asp.net - IIS URL Rewrite module but without any luck, can someone provide me with working example or suggest other way to accomplish this.
Please try to use Azure Web App Virtual Directory. Refer to this article to know how to deploy multiple virtual directories to a single Azure Website. Please try to deploy Test web app to the root project, and deploy Test.API to the virtual directory. After this, we can use www.mydomain.com to access the root web app, use www.mydomain.com/api to access the web app existed in virtual directory.

What is the exact difference between Windows Azure and Windows IIS?

I have finished developing a webapplication on Visual Studio 2012 along with Microsoft SQL 2008. I'm trying to make it a "live" webapp which can be accessed through the phone rather than a localhost.
I researched and found 2 solutions which are
IIS
Azure
I have been looking all over the net for various clear explaination of the main difference between IIS and Azure. From my understanding, IIS is a web server application that comes with Windows Server and is used to serve up web sites while Azure is a Windows hosting solution that utilizes IIS. In that case why do people still uses IIS while Azure provide both a cloud platform and IIS?
Which is also better to host any typical web-application that used to run on the localhost?
I can't seems to find any thread in SO or ASP.Net forum which can clearly explain the main difference between the two along with the advantage and disadvantage.
Here are some of the link1, link2 i have found that provide brief information about the two.
What you are looking for is actually a place to run your web application, Teo.
As you've found, you can do that in IIS if you have a server that is connected to the Internet. A way to get such a server is to either got to a hosting company or just use the Windows Azure cloud as you've found as well.
One of the simplest ways for you to do this right now and for free is to sign up for a Windows Azure trial account. As part of that account you get a basic, shared Windows Azure Website for free.
Here are the links you need:
(1) http://www.windowsazure.com/en-us/develop/net/tutorials/get-started/
(2) http://www.windowsazure.com/en-us/pricing/free-trial/
I would strongly recommend that you go through the entire tutorial (1) step-by-step before trying to do this with your own application. Before you start, sign up for a trial account (2). You will not be charged in the first month and you will not be charged if you stick with the free website.
Enjoy.
Comparing IIS to Azure is irrelevant. Those are two different concepts, which are vaguely related to each other. You lack some very basic understanding of what each one means, and I recommend you to go and read about each them from scratch.
IIS is indeed a web server application. That means, for example, that it can rout HTTP request and responds to and from the web site application that you have created.
To keep it simple, let's say that IIS can run on any Windows machine, which makes the machine a Web Server.
If you want to have your web site up and running, you need either have your own machine that acts as a web server, or either upload your web site application to some other machine.
Azure is a group of cloud services. One of the services is a Web Site Host, that allows you to use cloud computers to run the IIS that hosts your web site.
As part of the service, Azure will take care of installing and using the IIS server for you.
Bottom line, if you are going the Windows path, you will probably end up using Both Azure and IIS (unless you will want to self host your web site...)

Resources