2

Context

I have two asp.net mvc 4 apps, one is a standard CRUD-style app derived from the Visual Studio 2010 Internet App project template, the second comes from the Web API template, and is intended to function as a REST service. My intent is to run both of these apps on the same Azure Web Role instance.

Problem

When I attempt to access the web api using "view in browser" or by making the app the StartUp Project and using Debug->Start New Instance, I am able to issue GETs and retrieve responses with data. When I attempt to run these apps on my local machine hosted in the Azure compute emulator, NONE of the WebAPI routes ever resolve to the corresponding controller and I always get 404 responses. Only WebAPI routes exhibit this behavior - they appear to be completely ignored as if I'd never registered them at all.

It doesn't matter how the request is made - I can issue them from a browser, or I can issue them from (for example) a server-side RESTSharp client in another web app. In all cases, when this app is hosted on the compute emulator, none of the registered WebAPI routes resolve to the corresponding controller.

Question

What could I have misconfigured in my Cloud project such that WebAPI routes would be ignored ONLY when hosted on the local Azure compute emulator?

What I've Tried

I have reviewed these questions, neither of which contained any information which changed this behavior:

I tried separating the two apps out into separate web roles, but this had no effect.

I tried creating from-scratch Cloud projects with the out-of-the-box WebAPI projects, and these all seem to work without issue, so it does not appear to be an emulator defect. I've clearly got something screwed up in my current VS2010SP1 Cloud project config (I'm using the Azure v2.0 SDK tools for visual studio).

Code Sample

FWIW, here is my current ServiceDefinition config relating to the web role that's hosting these two apps:

 <WebRole name="DualSite" vmsize="Small">
   <Sites>
     <Site name="CRUDAppSite">
       <VirtualApplication name="CRUDApp" physicalDirectory="..\..\..\source\CRUDApp" />
       <Bindings>
         <Binding name="Endpoint1" endpointName="Endpoint1" />
       </Bindings>
     </Site>
     <Site name="RestAppSite" physicalDirectory="..\..\..\source\RestApp">
         <VirtualApplication name="RestApp" physicalDirectory="..\..\..\source\RestApp" />
         <Bindings>
             <Binding name="Endpoint2" endpointName="Endpoint2" />
         </Bindings>
     </Site>
   </Sites>
   <Endpoints>
       <InputEndpoint name="Endpoint1" protocol="http" port="9090" />
       <InputEndpoint name="Endpoint2" protocol="https" port="7080" certificate="RestAppSSLCert" />
   </Endpoints>
   <Imports>
     <Import moduleName="Diagnostics" />
     <Import moduleName="RemoteAccess" />
   </Imports>
   <Certificates>
       <Certificate name="RestAppSSLCert" storeLocation="LocalMachine" storeName="My" />
   </Certificates>
 </WebRole>
Community
  • 1
  • 1
Hoobajoob
  • 2,748
  • 3
  • 28
  • 33

0 Answers0