webworm
webworm

Reputation: 11019

Host a Web API under a Web Forms project

I have a ASP.NET Web APi project that uses an AngularJS as the front end. It is called "MyApiApp".

http://localhost/MyApiApp

I would like to move this project under another project that is an ASP.NET web forms website. It is called "MyWebForms" app.

http://localhost/MyWebFormsApp

My goal is to move the "MyApiApp" under the Web Forms app and access the "MyApiApp" as

http://localhost/MyWebFormsApp/MyApiApp

Is it possible to have an ASP.NET Web API hosted under an ASP.NET Web Forms project? I would like to be able to do this in Visual Studio where I could run that Web Forms application but have access to the "MyApiApp" app via the above URL.

Upvotes: 0

Views: 563

Answers (1)

Tim
Tim

Reputation: 4257

Yes. You should be able to set it up as a virtual folder in IIS underneath the main website.

In the case of the VS Project, the built in web server doesn't support virtual folders, you'd have to set it up to run through actual IIS.

You should be able to have the WebAPI Controller as part of the main web forms project though.

Upvotes: 2

Related Questions