Your default site is bound to all ports, so localhost:8000 is going to the original site.
In addition to the app pool you need to define a new site bound to port 8000. You will also need to limit the default site to port 80 instead of all ports.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have an existing website running, let's call it Portal, at http://localhost:80.
Now I need to add a related API so that a webhook can post data here.
I added the new web api, put it on port 8000, created a new AppPool.
http://localhost:8000
For debugging, I have Portal, the original website, turned off in IIS.
When I go to http://localhost:8000/api/Values, I get errors in the Portal code, when it should be hitting the Values controller.
[NullReferenceException: Object reference not set to an instance of an object.]
Portal.Controllers.BaseController.GetDefaultContext() in {path}\Portal\Controllers\BaseController.cs:39
and
[InvalidOperationException: An error occurred when trying to create a controller of type 'Portal.Controllers.APIController'. Make sure that the controller has a parameterless public constructor.]
This works fine on my local machine, just not on the server.
I can't see how it could get to the Portal code or even know about Portal controllers.
Any thoughts?
Your default site is bound to all ports, so localhost:8000 is going to the original site.
In addition to the app pool you need to define a new site bound to port 8000. You will also need to limit the default site to port 80 instead of all ports.
@Bruce Barker That is certainly what it acts like. 8: -)
Turns out it was a deployment failure. My script failed in changing directory when I thought it did, so it was copying the wrong files.
When I added some logging messages and none of my changes were showing up, I got suspicious.