1

I have a simple setup. I have a wordpress website setup at the root of a subdomain api.website.com. This will act as documentation for an API. I then have the API itself, built with asp.net and i want this to be a virtual application so that a user can query api.website.com/v1 as the base url for the API. The problem i am having is that wordpress is taking priority and is redirecting every request i make to /v1 to the 404 page. Sometimes it redirects to an actual page, but either way, the asp.net virtual application is not getting hit.

Here is the site info that i pulled from the applicationHost.config.

<site name="API" id="8" serverAutoStart="true">
    <application path="/" applicationPool="API">
        <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\API\Documentation" />
    </application>
    <application path="/v1" applicationPool="API">
        <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\API\SourceCode\API" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:963:" />
        <binding protocol="http" bindingInformation="*:80:api.website.com" />
    </bindings>
</site>

How to i make the server give priority to the virtual application so that if it picks up /v1 in the url it will go to the asp.net site instead of the wordpress site. I am running iis 8.5 on a windows 2012 R2 server.

Edit. I tried setting this same config up using IIS installed on my windows 8 laptop. The config i want is working here, so it looks like it might be IIS on the server that is causing this, but i still cant find out what could be causing it.

Dan Hastings
  • 706
  • 1
  • 13
  • 24
  • Your setup makes no sense. WOrdpress should not listen to api.website.com at all - only to www.website.com. You need to split the websites into two, with different bindings. – TomTom Mar 14 '17 at 15:27
  • 1
    wordpress is used for the api documentation. the site itself is not an api so www.website.com must remain as is. i want to allow for api versions in the future so api.website.com/v1, .../v2 etc. a documentation site then sits at the root of the subdomain – Dan Hastings Mar 14 '17 at 15:28
  • Something in the root site's config must pick up the `/v1` url, you can try to review the wordpress config and/or web.config file. Maybe running Failed Request Tracing can tell you which IIS module is picking up the request. If the parent site is handling the request, it doesn't get through to the child. – Peter Hahndorf Mar 15 '17 at 14:07

0 Answers0