ASP.NET Hosting multiple website under same folder with same domain - asp.net

I'm wondering how to host multiple websites under same folder. example:
www.mydomain.com/apps/app1
www.mydomain.com/apps/app2
www.mydomain.com/apps/app3
each of them is different app with separated web.config
my concern now is that my apps now cannot read dll files inside their own bin folder.
Is there any solution for that?
Thanks

You can do this within IIS. Just start up the IIS Manager and navigate to the folder (such as 'app3' in the Connections pane on the left). Right-click the folder and select Convert to Application. This will set the folder as the root for a separate ASP.NET web application.

Related

What's the difference between normal folder and application in IIS?

I'm setting up an IIS site, and want to support many different Sub-ENVs in one site. What should I do about IIS structure? An application within a normal folder or using sub application?
Directory Structure:
D:\MySite
|_qa1
|_app
|_qa2
|_app
One method:
MySite
|_qa1(normal folder)
|_app(application)
|_qa2(normal folder)
|_app(application)
Another method:
MySite
|_qa1(application)
|_app(application)
|_qa2(application)
|_app(application)
App pool
MySite: MySite
qa1: MySite_qa1
app in qa1: MySite_qa1_app
qa2: MySite_qa2
app in qa2: MySite_qa2_app
I read the doc Virtual Directory. But it is said that you might use a virtual directory when you want your application to include images from another location in the file system, but you do not want to move the image files into the physical directory that is mapped to the application's root virtual directory. It is different from normal folder.
So what's the better choice? And could you describe the advantage or disadvantage?
What's the difference between normal folder and application in IIS?
In my opinion, the main difference between the normal folder and application in IIS is the application will have its own application pool, but the folder don't.
The folder will inheit from its parent IIS's websites application pool.
I'm setting up an IIS site, and want to support many different Sub-ENVs in one site.
In my opinion, choosing which method is according to your actual requirement.
If qa1 or qa2 is just a folder which contains different apps, I suggest you could set its as a folder not a application, since become a application will have its own application pool, which will take system resource to run it.
If qa1 or qa2 is just a folder which contains its own application file, I suggest you could set its as a application, since it could be managed by different application pool.

How to create 2 asp.net web form applications in the same website each in different subfolder?

I'm creating multiple small ASP.Net Web forms applications i want on my host each project of those to run in different subfolders for the root directory of my host. When i puplish each project to different subfolders of the root directory all of them dont work. The only one that works is the one at the root directory. I think this issue is related to Web.Config. I want to ask is there a way to run each application of those in different subfolder without creating other websites ??
IIS
I have been doing this a lot for testing purpose before final deploy. I just host the new application in the virtual directory of the the existing website that we own.
for eg:- www.example.com is our site
and we have a application named xyz then url for new application will be : www.example.com/xyz
You have to add a virtual directory in the root of the IIS website and turn it into an application by right-clicking on it in the IIS management console.
Or simply you can put the website in your root website (as in your case) and then in the IIS management console convert that folder to application.
Create and Configure Virtual Directories
Setting Virtual Directories as Applications in IIS

Questions about copy IIS config files to another server

I have several asp.net web services is running in IIS. Now I want to move to another server in all exactly same IIS setting and using same web services. I know about copying a IIS config files(ApplicationHost & administration) to new server remotely but do I also need to copy all asp.net files to new server as well? If yes then must the asp.net files be in the same file path directory as the current one(D:\Website) for IIS in new server to be able to recognize it?
Yes, you would need to copy the ASP.NET files as well.
It is not necessary to put them in the same file path directory. Whatever directory you put them in, ensure your IIS Website Settings point to that directory and you have setup the same set of permissions etc. on it.
e.g. You could have had a website on c:\site on one web server. you could move the website files onto another web server and put them on d:\newsite\ and change the Website Directory Path in IIS Manager to point to D:\newsite\ directory.

How to deploy 2 separate ASP.NET solutions under one IIS website

I am facing the issue how to deploy 2 separate ASP.NET solutions in one IIS website. This is how I plan to deploy. In the root website folder, I put one solution's published files. Then, I create another folder in that root folder and put another solution's published files.
When I run from IIS, only the contents from root folder works but those inside a folder doesn't work.
You can use sub folders (add virtual folder) in IIS.
Remember to set the folders "Convert to Web Application" so it works with dependent configuration context.
You need to set the subfolder as an IIS application in IIS Manager.

why it is still necessary to create virtual directory in IIS when website content is placed in IIS root directory

As virutal directory points to physical path of the application, so if the IIS root directory is C:\inetpub\wwwroot and the application is stored at D:\websites, than we need to create a virtual directory but if the application content is placed at C:\inetpub\wwwroot, then why still need to create virtual directory.
Actually you don't need to create a virtual directory. What you need to do is define it as an application folder, adding a virtual directory does this by default so that's why it works. All you really need to do is right click the folder under your website, click properties and under the Application Settings section click create. Your folder will then have a gear icon off to the side denoting it as an application folder.
As to why application folders are necessary, I believe it's a way of forcing you to choose which Application Pool you want the application running in rather than having every sub directory application running off the same pool by default.
IIS isn't used just for ASP.Net, it can serve up PHP for example...so the type of application and pool varies, it's not automatically created and tied to then ASP.Net engine.
If you can clarify a bit more what you're trying to do maybe we can help further. For example, if you want to point the root application to another folder and it be an application or create another website, IIS allows you to do any of that...you just need to update the question with which version of IIS, as the instructions very between them.
If the IIS site will host a single ASP.NET application you can place it at the root (C:\inetpub\wwwroot) and you don't need to create a virtual directory because when you create the site it is already a virtual directory.

Resources