Azure web role (MVC 3 project) wont' start with Twilio controller class
The projects publishes, runs and twilio functions fine in my local VS Azure emulator environment.
The project References; Twilio.api, Twilio.mvc, Twilio.Twiml, RestSharp, and NewtonSoft.Json are all set to CopyLocal=True.
All Azure Diagnostic logging/tracing is enabled and sending to table storage every 5 seconds but no log data is available when the web role fails to start. Note: If I comment out the twilioController I get an abundance of log data so Azure Diags are configured correctly.
Because the web role continues to abort/cycle/abort, there is no opportunity to RDP to the vm for further troubleshooting.
The following two errors are written to the failing web role's Windows System Event Log about every minute:
The application '/' belonging to site '1273337584' has an invalid AppPoolId 'ca5c9ecb-e68d-4f3a-84c2-c0b4430373e9' set. Therefore, the application will be ignored.
.
Site 1273337584 was disabled because the root application defined for the site is invalid. See the previous event log message for information about why the root application is invalid.
Steps to reproduce (exact steps):
Success - web role starts
using System.Web.Mvc;
using Twilio.TwiML.Mvc;
namespace WindowsAzureProject857481.Controllers
{
public class HelloController : TwilioController
{
//
// GET: /Hello/
public ActionResult Index()
{
return View();
}
Any ideas appreciated.
Thanks, Jim
Jim:
I work for Twilio, and own the .NET helper library.
Whats happening is that the Twilio.Mvc assembly is looking for 2.0 version the System.Web.Mvc assembly, since that's what its built against. Its not finding it because its obviously not being packaged with your MVC 3 project.
The fix if fairly easy. Get the Twilio.Mvc source, change the reference to the newer version of MVC and recompile the assembly. I believe our support team is going to contact you with a version I built for you if you don't want to do it yourself.
I think there is probably also a way to use assembly binding redirects to fix the problem as well, if you wanted to try that.
Devin
I went through your repro steps, except that I changed one thing -- I enabled WebDeploy for the role early, before adding the twilio+deps packs and extending a controller from TwilioController. This way, the VM was already created and the role already started.
The first time I did step 3, web deploy caused an error:
COM object has been separated from its underlying RCW cannot be used
I am now retrying to make sure this last step is reproducible with WebDeploy. Have removed all Twilio and am publishing again to reset webdeploy. Will update answer in about 30 minutes.
Update
Ok, this is strange. I was able to reproduce the error above. However, I closed Visual Studio, restarted, and was then able to web deploy. I now have a controller in an MVC3 web role on Azure that extends TwilioController. <-- note this is temporary and will be removed.
I suggest you try the steps above, and even try your repro without using WebDeploy. However, before deploying with a controller that extends TwilioController, close and restart Visual Studio.
If that still doesn't work, try this:
Final Answer
I tried the steps above. When disabling web deploy, it appears to not matter whether the package is published from Visual Studio or manually from the portal. Both keep aborting and retrying. The only way I could get the TwilioController to deploy was by using WebDeploy, but of course this is not acceptable.
I suggest you file a support request with Microsoft. It doesn't appear to be a dependency as you mentioned though, since I was able to run the code on an instance by sneaking in the Twilio stuff over web deploy. It could have something to do with the COM object error mentioned above.
P.S. -- you owe me 96 cents for 8 hours of a small compute instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With