简体   繁体   中英

Create virtual directory for .NET Core application in .NET Framework app

I am trying to create a virtual directory (subfolder) in .net framework application. The directory is intended for .NET Core application. I need both of them to run under one domain. Currently I am using IIS Express and it is more suitable option for me than local IIS. I added the virtual directory to the .NET Framework application config. An issue I've faced is that when main .NET Framework app is making http call to the .NET core one, I am getting an error that Report Viewer (which is used in .NET Framework app) cannot be loaded for .NET Core app. Of course I don't need the Report viewer in my .NET Core app. I need to load .NET Core app separately. Could you please advice?

new HubConnectionBuilder()
  .withUrl(`${settings.NotificationServiceConnectionUrl}/${notificationSettings.hubName}`, {
    accessTokenFactory: () => accessToken,
  })
  .withAutomaticReconnect()
  .configureLogging(LogLevel.Error)
  .build()

You can add a sub-application under the ASP.NET application, this sub-application is .NET Core application:

在此处输入图像描述

在此处输入图像描述

This is the code in the ASP.NET application, it will call the ASP.NET Core Web API application:

public ActionResult About()
        {
            

            var request = (HttpWebRequest)WebRequest.Create("http://localhost/core/WeatherForecast");

            var response = (HttpWebResponse)request.GetResponse();

            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

            ViewBag.Message = responseString;

            return View();
        }

在此处输入图像描述

We can also directly access ASP.NET Core Web API application:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM