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

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.

Related

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

the element 'buildProviders' cannot be defined below the application level

I have created an asp.net C# application developed in visual studio 2010, which is running without any error on my PC, but when i tried to run the same application on another computer with visual studio 2010, it gives following error,
The element 'buildProviders' cannot be defined below the application level.
Following article at http://forums.iis.net/t/1160248.aspx?The+element+buildProviders+cannot+be+defined+below+the+application+level+
You probably need to convert the virtual directory to application. I encountered this when deploying my app (using NancyFX).
You can open IIS Manager->Right-click the diretory of your web application->Click Convert to Application.
I faced this problem and i found out that somehow i had another version of my website within the subfolders of my webstie.
Meaning that my website is in a folder called "FrontEnd". Withing this folder there is a subforlder called backup that contains a backup of my website.
when i removed the backup folder, everything went ok.
If you recently upgraded your solution, check for the backup directory for crystal report within your solution. The backup directory can get created when you upgrade visual studio. To resolve this error, closed the solution. Went to the solution directory
and delete or move the backup directory to a different location outside of the solution directory. This solved the problem for me
You can fix this problem either defining the element in the web.config file of the root dir or setting Virtual Directory as APPLICATION in IIS.
For doing this with IIS 6.0, you first have to set the the directory in which your site is present as a Virtual Directory and then define this virtual directory as an Application.
All physical directories under Inetpub\Wwwroot are not considered applications until the following procedure is used:
Open IIS Manager.
Expand the Default Web Site node and look for the subdirectory that you want to designate as an application root.
Right-click the directory that you want to mark as an application root, and then click Properties.
On the Directory tab, in the Application Settings section, click Create.
In the Application name text box, type the name of the application, and then click OK.
The virtual directory is now an application root.
Maybe on oppening website you were selected upper project directory as website root
In my case, the issue was that the web.config inadvertently existed in a subfolder of the applications root folder. I had a "temp" subfolder, and I had placed a copy of the web.config there, unaware of the unintended side effects. The solution in my case was to remove the dup copy in the subfolder. Hth
(In my case name of project was repeating in directory )
The problem's solution is very simple: check its root directory in Solution Explorer. If there is a name folder within another name folder then this error will occur. Your web site contents should be very first after your web site name folder. In other words, contents should not display in another same name folder.

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.

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.

Project load wrong web.config file

I am using Visual Studio 2008 for .net project.
I have configured to use IIS as debug web server in the project property page.
I have two projects under c:\project, project1 and project 2. I can run project 1 with no problem. However when I try to run project 2 I got an error message, saying the web.config file is missing binary file from bin folder.
The server is trying to load the web.config file from project1 instead of project2.
I have checked the virtual path settings and project settings and could not find anything wrong.
Does anyone have such experience?
I could not find useful information on google.
Thanks,
Lewis
I found out that ON IIS manager, Default Web Site -> Basic Setting -> Physical path was set to perticular project.
I've changed it to C:\inetpub\wwwroot now when I run individual applicaiton they go and pick up correct config files
Make sure that project1 is an application whose base folder is the project1 directory and that project2 is an application whose base folder is the project2 directory. sounds like project1 is an application pointing to c:\project.
EDIT: How are your directories defined in IIS? If they are virtual directories, they must be defined as applications, otherwise it will try to use the root web.config.
Try this:
Shutting down all instance of Visual Studio
Stopping IIS (iisreset or restart the WWW service)
Delete everything in this directory: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
Open your projects back up
I also had this problem, it turned out I had mistakenly set up my website incorrectly in IIS.
I was pointing my default website to files for project 1, while a sub-application inside the default website was pointing to files for project 2, which was of course inheriting the web.config of project 1.

Resources