I've got an azure website (MVC) configured and everything was working fine until i tried adding a WebAPI project to solution which is deployed to azure.
My virtual directory mapping looks like
- virtual ----- physical --- IsApplication
- / ----- site\wwwroot\ ------ IsApplicaiton (yes) [Path for mvc
- /api ---- site\services\ ------- IsApplication (no)
- /api/code ------ site\services\code\ ------- IsApplication (yes) [Path for WebAPI project]
Web.config settings "waterfall" down within applications. So if you have an application hosted at the root '/' and then another application hosted under that (i.e. '/api/code') then all of the settings from the root web application's web.config will be added into the settings of the sub application's web.config. The physical location of the application is irrelevant to this behavior. All of this is driven by the virtual directory structure. This is why you are seeing errors related to your MVC app's namespace in your WebAPI app.
To fix this you should use
<remove name="..." /> or
<clear /> tags or
inheritInChildApplications attribute in your WebAPI's web.config to remove settings that are passed down from your MVC application. An example of how to do that can be found in this SO answer: http://stackoverflow.com/a/5968658/6387007
For more information on web.config inheritance you can check out this MSDN article too: https://msdn.microsoft.com/en-us/library/ms178685.aspx