Deploy MVC Website as an application into MVC website - asp.net

I have an MVC web application deployed at the root of IIS but I have another MVC website application that needs to be deployed under the root web application.
I tried to add the child web application via 'Add Application' under website at the root but it is unable to read web.config of the inner application and giving some assembly errors that are included in the inner web application.
Please provide me procedure how I can deploy MVC web application under the MVC website. I hope the snapshot will clear the question.

I copied assemblies in the parent site that were being used by the child web application and it then worked.
One more solution seems possible, if the child web application routes are ignored by parent site. Though I haven't tried it.

Related

IIS URL Rerouting MVC 404 Error - Hangfire

I'm trying to add an MVC site under a domain where there is an existing site. The new site is just a simple mvc site to show a hangfire dashboard. I'm using IIS 8.5.
The current site is an old ASP.NET Web Forms site and will not allow the routing to the new MVC application and I get a 404.
The old site needs to be accessible at https://example.com and I need to be able to access the Hangfire site at https://example.com/Reporting/hangfire.
I have the MVC application configured and it works when the physical path of the Web Forms site is not pointing to the root folder (example.com).
I am new to the routing configuration in IIS so I am not sure if there is a URL Rewrite rule that would be useful for this or if need to do something else.
Edit
This is the root site, its a web forms site deployed by someone else. I added the MVC site as an web application and it uses a different app pool. I get a 404 in this case because the web forms app is handling the routing and its never getting to the MVC app.
I was able to get this working by deploying the site under a sub-domain; I had to convince our admin to allow this. The MVC site worked on its own but never when nested under the Web Forms site.

Routing fails when api is created as a web application under another site

I developed a rest api using ASP.net web api. When I deploy this rest api on iis, I need to create it as a web application under an asp.net web site. When I was deploying the rest api as a new web site in iis, then things worked fine. I was using the following Route api/{controller}/{id}.
When I created the rest api as a web application underneath asp.net web site project, I named the web application as api. I can't access the api methods now. Can someone point what I do wrong?
WebApi is based on global.asax and web.config configurations and you can't have 2 of these files inside in the same application. In the scenario you described, it sounds like you need to create a "Virtual Directory" in IIS for the second application instead of making just a "Sub Folder".
The Virtual Directory will allow you to declare a new web.config and global.asax where you set the new routings and configurations method for your second application.
For a full walkthrough on how you can perform this please refer to this site:
http://msdn.microsoft.com/en-us/library/vstudio/bb763173(v=vs.100).aspx

Any modification necessary to web api project web.config when web api project is created as a web application under an asp.net web site?

I have an asp.net web site which runs on port 443 which is https. I also have a asp.net web api which also needs to run on port 443. Because of that, I decided to create a new web application under asp.net web site. I also created a new application pool for that. The problem is that when I try to run web api project, I keep getting configuration file errors. For example it says Default Connection is already added since asp.net web site web.config adds Default Connection already before web api project does. Are there any special steps to take in order to make this work?

MVC 3 on IIS 7 returns 404 for MVC extensionless url requests

Our website is a mix of asp.net web-forms and MVC 3. The website is developed in web-forms, except for a separate MVC application that is stored in a separate Directory in the root of the website and having its own web.config. The web-forms pages (aspx) are served properly by the IIS 7 server, but MVC url's are returning 404 - File or directory not found.
For example, say the website is www.abc.com and the MVC application is accessed using www.abc.com/aaa/controller/action, where aaa is the root directory for the MVC application and contains its own web.config. The web-forms url (say www.abc.com/feedback.aspx) is working but, the MVC URL's (say (www.abc.com/aaa/Controller/Action) are returning 404.
I have confirmed from my shared hosting provider, that the website is running over .net 4 Integrated pipeline Mode application pool, so extensionless url's should be handled by the IsapiModule by default, without requiring any extra configuration for the same.
One doubt that crops in my mind is whether the MVC application root folder (aaa in above example) should be converted to a separate application ?
Any guesses, to resolve the above MVC url issue?
The hosting provider uses WebsitePanel , through which I was able to create a Virtual Directory for the folder containing the MVC application. The MVC URL's are now being routed to the Isapi handler and not returning 404(file not found) any more. So, I guess I will close this topic here.
In short, creating a virtual directory for the MVC application resolved the issue.
asp.net-mvc and webforms share the routing system. You should make a Hybrid WebApp, part WebForm and MVC. I did something similar recently here, where the webforms is the main app and the MVC is the nested one. In this case, you must have only one global.asax and a single web.config for the entire site. The MVC could live at the same directory as the WebForm, but only with they share stuff.
I followed this guide from Scott Hanselman to make this work.

asp.net mvc 2 web application inside a Web site?

I have a Asp.Net Web Site deployed as a WebSite inside IIS 7.5.
http://localhost/WebSite
Then I have a second Asp.Net MVC 2 web application which is deployed as Sub Application inside the above WebSite. So the mvc aplication should work on the following Url.
http://localhost/WebSite/MvcApp/
The web site works fine but when I browse the mvc Url http://localhost/WebSite/MvcApp/
It gives following error.
HTTP Error 403.14 - Forbidden The Web
server is configured to not list the
contents of this directory.
UPDATE: I have got this working. The issue was that I was missing the Web.Config inside the Views folder in the Asp.Net MVC 2 application.
You might need to create a virtual directory for the ASP.NET MVC application which will be associated to its dedicated application pool.
I know I had the same problem some time ago. In my case the two applications ran a siblings, not one inside the other. The problem was the web.config in the root directory (above the two sites) conflicting with the the web.config in the seperate sites. I solved it by just deleting the root web.config (since I have nothing running in the root.
So my advice (I know it's definately not a solution) is to check for conflicts in your web.configs.
Is you Asp.Net MVC site running ASP.NET 4.0? If so, make sure the app pool for that MVC site is setup asp ASP.NET 4.0 and not ASP.NET 2.0.
From within IIS Manager, you can right click any folder in the tree to be converted to an application. Have you tried it?
It sounds to me like the mvc routing module is not executing on your requests. You might want to check to make sure that not only is the web.config in your base web application not loading a module to supersede the routing handler, but that the web.config for your mvc application is handling routing properly. Take a look at this article for a rundown of the dependencies for routing and how it is configured internally within iis.

Resources