locked
Hosting ASPNETCore sub-application under ASPNET website RRS feed

  • Question

  • User-1564763863 posted

    I have 2 applications, let's say it a parent application and child application.
    Parent application is developed in ASP.NET MVC 5 targeting to .NET Framework 4.6.2 and is hosted in IIS and running successfully on server.
    Child Application is developed in ASPNET Core.
    Now, I am trying to host the child application under my parent application. So far I tried, and I am able to host it under parent application. Means, whenever I browse my child application without authenticate, system is redirecting me to the parent application login page. Till here everything is working.

    Now after Authentication, when I go to my child application request is not hitting to my application.

    Any help will be appreciated.

    Thanks in advance.

    Anand Neema

    Monday, May 20, 2019 5:39 AM

All replies

  • User753101303 posted

    Hi,

    And what happens ? I never really tried and until now always avoided a parent/child app structure, using rather site.com/app1 and site.com/app2 which as less as possible at site.com/ (such as just  a static portal ?) my understanding being that it is relatively hard to insulte a parent app from its child app.

    Could you tell what happens so that we one that would try could see if running into  the same issue. I believe you may have to use something such as https://docs.microsoft.com/en-us/dotnet/api/system.configuration.sectioninformation.inheritinchildapplications?view=netframework-4.8 in the root app, use distinct app pools but I'm not sure if it is enough to fully isolate them ?

    Edit: the IIS forum could be better for seeing what is possible or not with parent/child applications...

    Monday, May 20, 2019 11:29 AM
  • User-1564763863 posted

    It is showing me the directory structure of the child application. I should see the web page instead.

    Wednesday, May 22, 2019 7:28 AM
  • User585649674 posted

    Do the parent and child app have different app pool. the parent app should have the app pool with .net clr version as v4..." and child app should have app pool with "No managed code" ?

    parentapp/feature should be handled by parent app. where feature is a controller in parent app. parentapp/site should not be handled by parent app. since it should be handled by child app.

    Wednesday, May 22, 2019 7:44 AM
  • User-1564763863 posted

    Thanks for the reply Nideesh. 

    Yes parent and child both have different app pool and also .NET Clr version for child app is "No Managed Code" and for parent it is "v4". but still I am not able to browse my child application.

    Wednesday, May 22, 2019 11:29 AM
  • User753101303 posted

    It seems directory browsing is enabled (should not if you never really need it). This is the last, resort when you point a browser to a folder and the web server doesn't know which "default document" should be served. For now it seems the ASP.NET Core application is not installed correctly. What if you try to install this first on its own site (you should be able to add later a sub app pointing to the same directory).

    I would really have to try to see if I can make this work but I'm really very prudent when trying to mix this kind of thing (and prefer to use sibling applications rather than really chil/parent). I believe insulating a parent/child app is not that easy.

    So you want site.com to be a .NET 4.Xx application and site.com/myapp being an ASP.NET Core application ?

    Wednesday, May 22, 2019 11:40 AM
  • User-1564763863 posted

    Patrice,

    If I disabled directory browsing, I am getting 404 error. Also I rechecked, ASP.NET Core is properly installed since I am able to host standalone ASPNET core app inside IIS.

    To answer your last question, yes I want site.com to be in .NET 4.6.2 application and site.com/app to be a core application.

    One question from my side, If I host as a sibling application will I be able to share the Auth tokens and session information seamlessly?

    Wednesday, May 22, 2019 12:31 PM
  • User475983607 posted

    To answer your last question, yes I want site.com to be in .NET 4.6.2 application and site.com/app to be a core application.

    A separate application is required for the ASP.NET Core application.

    One question from my side, If I host as a sibling application will I be able to share the Auth tokens and session information seamlessly?

    The ASP.NET and ASP.NET Core can share an authentication cookie as illustrated in the following doc.

    https://docs.microsoft.com/en-us/aspnet/core/security/cookie-sharing?view=aspnetcore-2.2

    Wednesday, May 22, 2019 1:27 PM
  • User-1564763863 posted

    A separate application is required for the ASP.NET Core application.

    With separate application, do you mean that I need to host ASPNET Core app as a separate Website and not under my ASP.NEYT MVC website in IIS?

    Thursday, May 23, 2019 2:35 AM
  • User585649674 posted

    The aspnet.core application seems to work only when they are hosted separately. I tried to add a aspnetcore application under default website of IIS. It did not work.

    ASP.net core starts a kestrel server at a different port. This port is mapped to url in IIS, which forwards the request to kestrel. Inside aspnet.core there is areas, controller and action name, customizeed routes. ASP.netcore also has a wwwroot folder which is default folder for static pages with extensions such as .jpg, .css, .js, etc.

    When IIS site is started, It looks at web.config and starts ASPNetCoreModule, which in turn starts the *.exe

    When ASPNetCore is started as child directory. It is not able to process the url correctly.

    Tuesday, February 18, 2020 7:28 AM