How to host multiple .NET Core apps under same url

后端 未结 6 774
南旧
南旧 2020-12-31 07:21

I am building a few web sites in asp.net core (multiple user interface applications and a web api app). They all work together, utilising the web api. For the purpose of m

6条回答
  •  心在旅途
    2020-12-31 07:26

    Suppose your main web directory is :

    mainweb\
    

    Make sure you have a valid ASP.NET application running in your App1 subfolder:

    mainweb\App1\
    

    Now install your dotnet core 2 or 3 app in the App1\ folder with all the dependencies etc.

    Next, drop this web.config in that same folder:

    
    
      
        
          
            
          
          
        
      
    
    

    Now suppose you want another dotnet core web api named App2\ running under mainweb also:

    1. Just create the new folder mainweb\App2\
    2. Create a new asp.net application in that folder via IIS or your special web hosting app.
    3. drop the web.config above and change the one line for the process path to .\App2.exe

    When the mainweb ASP.NET application starts it will start the dotnet core apps also. All good and they run under your mainweb as :

    https://mainweb.com/App1/WeatherForecast/ // WeatherForecast is controller name
    
    https://mainweb.com/App2//
    

提交回复
热议问题