Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web API on Azure errors until App Pool is Recycled

I have a web role that hosts 4 MVC 4 sites. One of the sites (let's call it the API site from now on) uses both MVC and Web API. When I upgrade the web role, the Web API controllers from the API Site returns a 500 Internal Server Error to all requests. The MVC controllers work as expected and I know the request is getting at least as far as the Application_BeginRequest method of the global.asax. I'm not seeing anything logged in my Elmah log. The only hint I have of anything being wrong is the following in the event log:

The application '/' belonging to site '1' has an invalid AppPoolId 'DefaultAppPool' set. Therefore, the application will be ignored.

As web roles use App Pools with guids as identifiers I don't know where this is coming from.

What is most confusing is that once I recycle the app pool for the API site (which is a guid) everything starts working correctly.

I've tried recyling the app pools as part of a startup task on the role, but that doesn't seem to make any difference.

Any suggestions about what I can do to get Web API to start correctly?

like image 700
knightpfhor Avatar asked Nov 12 '22 23:11

knightpfhor


1 Answers

I never did find what was causing this issue.

It got to a point where I could deploy from my machine and not get the problem, but my colleague could not.

We tried comparing the contents of the .cspkg files that were produced, but didn't find any differences.

We are now both able to deploy the project with no problems.

My suspicion is that this was resolved when we upgraded the Azure SDK and tools on our machines.

like image 84
knightpfhor Avatar answered Nov 27 '22 18:11

knightpfhor