6

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.

1

1 Answer 1

5

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:

enter image description here

modify the application pool from the application advance setting.

now you can browse the site.

enter image description here

folder structure in iis:

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

..thanks for the detailed answer. i have one question. Hosting .net core web api as virtual directory is not feasible? Is there any specific reason to deploy it as sub application instead of virtual directory?
@Developer 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 can not set different application pool if you host the .net core site as a virtual directory in iis.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.