Multiple applications under single domain, in corresponding folders - asp.net

This is a bit unusual, but somewhat reasonable. I have a domain say mycompany.com and a sub domain demos.mycompany.com and I want to host some demo applications under this sub domain.
So I created a website in IIS (7.5) say demos.mycompany, and added 2 applications to it named demo1 and demo2 which contains a different website application, and they can be accessed via demos.mycompany/demo1 and demos.mycompany/demo2. The root website (demos.mycompany.com) loads correctly and works fine. But the problem is for demo1 which is an asp.net web api project. The problem occurs when a request to web services is made, for example demos.mycompany/api/Account/UserInfo is not found because the project base URL is changed to demos.mycompany/demo1 and therefore the mentioned web service is available at demos.mycompany/demo1/api/Account/UserInfo.
I don't know if there will be other problems with this approach. This was just the one big problem that I found, There may be other shortcomings to this.
Are there any suggestions to solve this problem?
Is there any other issues to consider before going on with this approach?

Related

Is it secure to put all of your ASP.NET web apps under the same website in IIS (e.g. Default Website)? (more inside)

I am going to need to host multiple websites in IIS, but will not have separate URLs setup in DNS for each one. Because of this, I will not be able to use the Aias/CNAME functionality in IIS to redirect traffic to individual Websites in IIS.
Would it be secure enough to publish all of my web apps to the same Website in IIS?
Example: under Default Website, there is a folder for each individual web app:
-Default Website
--[folder for webapp1]
--[folder for webapp2]
--[folder for webapp3]
URLs used to access each web app:
www.mydomain.com/webapp1
www.mydomain.com/webapp2
www.mydomain.com/webapp3
Is this sort of setup secure or a good idea (best practices)? It seems like a simple solution to the problem of not having a separate domain name in DNS for every web app (website).
What do you think?
I don't see any issue with that approach, in a way it does simplify things quite a bit actually.
Sites being secure is not going to be affected by this. Of course each application would be under it's own pool, it's always a great idea to run like this.
This being said, your main website is going to run under it's own application pool and if there is a problem with it all your applications will be affected. That's the one thing I would pay extra attention to so you might want to not actually use that top level app pool for anything.

Run duplicate IIS websites on same database

I need some guidance in "best practice" for the following scenario:
I have a product that consists of an ASP.NET website and native smartphone apps for Android/iOS/WP that uses the website URL to call webservices.
We want to move the website from "www.ourdomain.com" to a sub domain like "www.login.ourdomain.com"
This means we're going to update the apps to point to the new URL which isn't a problem.
But as we all know, not all users update their apps instantly, so we want to have a "cross over period" where we run the website on both URLs.
It'll use the same database, but the ASP.NET site code will be altered a bit for the new sub domain site.
Is there any problems in doing this kind of cross over where 2 ASP.NET sites share the same database? (All id's in the db is auto incremented, or GUIDs)
Any help, suggestions or concerns is much appreciated.
I don't see any problem using different service URL for existing mobile apps(Old URL) & updated mobile apps(new URL) and website. I'll call it proxies.
The critical part is regression testing for mobile apps (old one & new one), with the latest change.
It would be great, if deployment fully incorporates the Deployment Workflow.

Difference between creating my asp.net MVC web application ,under the IIS Default web site, or create it as a new web site

I have published my asp.net MVC web application under the “Default web site” inside IIS. I actually added two versions of my web application:-
one directly under the default website and it can be accessed by typing http://servername
one under presaging path , and can be accessed by typing http://servername/prestaging
so I got confused on which approach it is recommend to add my asp.net web application, and what is the difference between adding my web application under the default web site, or creating a whole new web site ?
Thanks
This has more to do with organization within your company's IIS structure than right and wrong. If the site you built truly is the only site on the server, putting it on the Default site is not looked down upon.
But if the application is a sub application of the default site, the latter approach is the more appropriate approach if you only get to access the site from the //servername URL.
If you have a separate domain, myapp.servername.com, you can install it into the default iis site and add a binding or you could create a whole separate web site.
Has more to do with your structure than right or wrong.
Edit
To answer your comment, creating the site under the default web site will make the URL in most cases be: 'http://myservername/MyApp'. Creating your own application would require (in most cases) a separate binding address, 'http://myapp.myservername.com' It is really only affecting the URL you place in your browser and nothing else. More complicated setups are possible, but for most cases, these are your two options.

Multiple ASP.NET clone sites accessing different Databases

I have a problem and need advice on how to start solving it.
I have made a an ASP.NET site with visual web Developer that use a VB.NET DLL.
I configure in WEB.config, the connection string for the database.
The problem is that I need to have many copies of this site, each one connecting to a different database. That means, that I have to have one copy of each aspx, one of the dll, etc. for each site, which is a nightmare in terms of actualization, because I need that every site is equal to the others. If I add some functionality to one site a need to update every other. If I have 2 or 3 sites there's no problem but actually I have near 30 and growing.
My idea was to split the site in two: one simple login site per each client which stored the connection string, fill the session variable(including connection string) and then redirect to a single application site, which is the same for each client. But the problem is that is hard (for what I know) to share session objects between sites.
I'm I missing something? is there a better solution for this problem?

Share application variable between 2 websites (IIS 7.5)

I have two urls that are supposed to lead to the same actual folder.
I can't do a redirect because the websites are built so they question the URL and perform accordingly.
So I built two application in the IIS (I tried using a virtual directory for one of them, but I kept crashing on the web.config can not be read). Everything works perfectly except the Application variables which are different between the two addresses. (Specificly I'm counting the number of current users logged on).
I tried to switch from InProc Session management to SQL, but that didn't solve the problem.
Maybe the solution is somewhere in the IIS so I'll have a proper redirection without using another application? Any ideas how to do that?
The SQL session manager would do the trick but you need to configure it specifically so that it thinks they are the same application. Is this user specific variable, or global application variable?
Since you basically have one app, but want two url's I would try to map them to the same app.
If it's two different host names you can use host headers in IIS to have them both go to the same web application.
If you want two different paths to go to the same application you should look into using the IIS Rewrite Module. Set up an application on one url, and create a rewrite rule to map the other url to the first one.
There's a lot of information on learn.iis.net about the URL Rewrite Module.

Resources