Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to host ASP.NET Web API 2 project on IIS 10

Tags:

rest

asp.net

iis

I am trying to host an ASP.NET Web API 2 project on IIS 10, and I keep getting a page saying Service Endpoint not found.

The project I am using for testing is the sample ProductsApp project here Getting Started with ASP.NET Web API 2. If I run the project in debug, then the page shows up as expected while it is being hosted through VS2012 IIS express at localhost:54170

I am then publishing that project to file using VS2012.

After publishing to file, then I made a new site on IIS 10 at localhost:8080 and point the physical path to the folder that I published the ProductsApp project to.

At this point if I go to browse the site it comes up with a page that all it says is Service Endpoint not found.

I've changed my DefaultAppPool Identity to LocalSystem, so I don't think it's a permissions issue.

How do I get the site to show up like it does when I'm debugging from VS2012, but from IIS 10?

like image 662
TJ Rockefeller Avatar asked Feb 09 '23 17:02

TJ Rockefeller


1 Answers

I wasted so much time yesterday trying to figure this out, but this morning with a little fiddling I found my answer which I'm surprised I wasn't able to find anywhere else I looked.

To fix my problem this is all I had to do.

  1. Instead of hosting the ASP.NET content as its own site I just needed to add an application to my default web site with the physical path pointing to the folder that was published from VS2012.

  2. This is obviously my first time using ASP.NET, so I didn't have any of the ASP.NET features installed in IIS. I went to Turn Windows features on or off -> Internet Information Services -> World Wide Web Services -> Application Development Features, then selected all of the ASP folders (ASP, ASP.NET 3.5, ASP.NET 4.6). Edit: Looking back at this, all that was required was turning on the feature ASP.NET 4.6. At the time I didn't know what I was looking for, so I tried to nuke the problem by installing everything with "ASP" in the name.

  3. The DefaultAppPool Identity didn't need to change to LocalSystem, so I changed it back to ApplicationPoolIdentity.

Now I have the ASP.NET site up and running on my localhost.

like image 126
TJ Rockefeller Avatar answered Feb 12 '23 18:02

TJ Rockefeller