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.
Related
Let's say I have domain "mysite.com". I want to go to wordpress site when I'm on "mysite.com" and do asp.net mvc when I'm on "mysite.com/app".
Is it possible? (Hosting that I consider has iis and wordpress installed)
Let's say I have domain "mysite.com". I want to go to wordpress site when I'm on "mysite.com" and do asp.net mvc when I'm on "mysite.com/app". Is it possible? (Hosting that I consider has iis and wordpress installed)
According to your description, I suggest you could consider using add nested web application inside the workpress IIS web site to achieve your requirement.
More details, you could refer to below steps:
1.Deploy your MVC application to your server by using web deploy
2.Right click the wordpress site and click add application inside the IIS
3.Type in app as the alias and select the MVC folder as the physical path
4.Click OK
Result:
using windows IIS hosting you can get what you need.
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.
I have an Asp.Net 4.0 Web Forms project that uses url routing for user friendly urls, i.e hiding aspx-pages behind clear text urls.
In this project we have an asmx web service that serves some jQuery controls on the pages. Everything has worked fine so far on development machines and the internal testing site but now when we installed the project on a production site the asmx calls are trapped by the routing code.
We have a catch all route that is added last that shows the Not found -page.
When I open the web service on the server (http://localhost/service.asmx?op=MyWebMethod), enter some values and click Invoke I get the Not found page. The url that Invoke opens is http://localhost/service.asmx/MyWebMethod so it's all quite logical (service.asmx looks like a directory) but I don't understand how this can work on all other installations of the same project.
The production server is Windows 2008 Server R2 Standard, the project is Asp.net 4.0 and I haven't registered any StopRoutingHandler for asmx-files.
The web.config files are identical between the internal testing site and the production site and the machine.config -files haven't been touched to my knowledge.
routes.Add(new Route("{resource}.asmx/{*pathInfo}", new StopRoutingHandler()));
I have two web site sites on IIS 7 (Default, Custom). Both Sites host the same web application.
Some of the web application behavior changes depending under what web site it is running. Is there a way for the web application to find out what is the name of the WebSite under which it is handling the current request.
Thank you
Imran
System.Web.Hosting.HostingEnvironment.SiteName
will get you the site name as it appears in IIS
Request.Url.Authority
will get yo the requesting url
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.