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

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

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.

ASP.NET Hosting multiple website under same folder with same domain

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.

Is it possible to run ASP.NET in IIS 7.5 without creating Virtual Directories or Applications?

I have a Continuous Integration server with dozens of ASP.NET applications hosted on IIS. Everytime I want to deploy a new application, I have to create a new Website or virtual Directory and configure it as an application in IIS.
I would really love to have only one website listening in a specific port (say, 80) serving multiple ASP.NET sites according to wildcard host headers.
For instance:
*.dev.mydomain.int -> my server's ip address (eg: 192.168.1.32)
IIS web site reads the host header and try to find a local folder with the same name. Ex: when a request uses the host header "helloworld.dev.mydomain.int" IIS tries to open a preconfigured folder appending the host header site name (e.g: D:\dev\helloworld)
IIS serves the contents of the folder as an ASP.NET application, using preset configurations (Application Pool, ASP.NET version, and so on).
My goal here is not to create a web site or virtual directory for each and every project in our CI server. I know I can create them programmatically, but I'd prefer a more dynamic solution.
Thanks in advance
You can use MSBuild tasks to create Virtual Directories / Web sites automatically.
http://fczaja.blogspot.com/2009/02/automatic-deployment-of-webapp-on-iis.html
I had it working on a large application with many branches (we had an environment for each branch) and I didn't have to open IIS settings at all. Just pure hands-off process.

Nested virtual directory or application within sitecore site, is it possible

I would like to nest asp.net web app within sitecore site, something like this:
<sitecore web root folder>
.
<virtual directory/app folder>
I want to access sitecore site by using following url:
http://<whatever site name>
and I would like to access web app by using following url:
http://<whatever site name>/<whatever virtual directory/app alias>
Is this possible?
I tried it but when I try to access my web app (not sitecore) then web app complains about missing sitecore.
I believe that is because now I have two config files ans when accessing web app iis/asp.net processing first sitecore web.config.
Right, your assumption is correct. See Creating a project in a virtual directory under Sitecore root article for more information about this kind of setup.
You should be able to create a virtual app under a Sitecore root path. Because its an app it will use its own app pool and you can have a web.config for it. I guess the physical files will be OUTSIDE of the Sitecore Website folder but the from a URL you can make the virtual app located anywhere below the Sitecore root.

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