简体   繁体   中英

How to deploy .net core web API as a virtual directory

I have a one asp .net website in IIS with .net framework 4.5. Now I want to add .net core web API as a virtual directory to this asp .net website.

How to achieve this? I am receiving 500 internal server error when trying to hit the controller.

first instead of host .net core site in iis as virtual directory host as an application.because .net core site use no managed code application pool in iis and .net framework site use .net clr version 4.0.

you could follow the below steps to host the .net core site in iis:

1)Publish site from the visual studio as a folder.

2)Make sure you download and install the .net core hosting bundle and runtime.

https://dotnet.microsoft.com/download/dotnet-core/3.1

Note download based on your version.

3)Right-click on your site and click add the application. set the folder path where you published the site from visual studio.

4)Make sure that the Application Pool > Process Model > Identity is set to ApplicationPoolIdentity or your custom identity has the correct permissions to access the application's deployment folder.

5)Create a new application pool. Set the application pool .NET CLR version to No Managed Code:

在此处输入图片说明

modify the application pool from the application advance setting.

now you can browse the site.

在此处输入图片说明

folder structure in iis:

在此处输入图片说明

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