rui
rui

Reputation: 11284

How can I run a MVC-4 app in a Azure Worker Role?

I have seen in the link below that it is possible to have the long running WorkerRole main loop in a Azure Web Role.

http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/how-to-combine-worker-and-web-role-in.html

Is it possible to have an Azure WorkerRole that spawns the ASP.NET MVC-4 app from its main loop (RoleEntryPoint.Run()) method?

Does anyone have a pointer to a snippet that does this?

thanks, rui

Upvotes: 0

Views: 344

Answers (1)

kwill
kwill

Reputation: 11008

What is your scenario for wanting to do this? Worker Roles do not have IIS installed, so you won't be able to run MVC4 in a worker role. If you are just wanting to have a Run() method in an MVC4 webrole then you can add the following to WebRole.cs (much like the article you linked mentions). This will cause the following code to run in the WaIISHost.exe process while your MVC4 code runs in w3wp.exe.

    public override void Run()
    {
        // Your code here
        base.Run();
    }

Upvotes: 1

Related Questions