开发者

host MVC app inside a website

I have a website (not a web application- in visual studio you get two options-create a website/project) running on IIS 6.0. Now I want to develop few features in MVC architecture. So I created one MVC application in visual studio and everything is working fine on localhost as a separate application. Now I want to host this MVC app also inside the website I have already deployed.

I created a virtual directory(MVCDir) inside the default website in IIS 6.0. The global.asax file which was in root folder I added the routing function-

Shared Sub R开发者_StackOverflow社区egisterRoutes(ByVal routes As RouteCollection)
    routes.Ignore("{resource}.axd/{*pathInfo}")
    routes.Ignore("{resource}.aspx/{*pathInfo}")



    routes.MapPageRoute("Default4", "{controller}/{action}/{id}", "~/MVCDir", False, New RouteValueDictionary(New With {.controller = "Home", .action = "Index", .id = Mvc.UrlParameter.Optional}))

End Sub

*** NOTE- If I write routes.ignoreRoute instead of routes,ignore it says- IgnoreRoute is not a member of System.Web.RoutingCollection*

I called this routing function inside application_start function now when I run domain.com/home/index

How to solve this problem? it says resource not found


Maybe this is a problem with you child application inheriting configuration from parent. I had a similar problem when trying to put an app under a website.

You'll need to wrap <system.web> in <location> tag with inheritInChildApplications="false"

Example:

<location path="." inheritInChildApplications="false">
  <system.web>
    <!-- ... -->
  </system.web>
</location>

Here you have more detailed explanation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜