Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET 5 web application as Azure Web Role?

We have a ASP.NET 5 web application in our solution.

Typically, we could right click on the Cloud Service "Roles" item and add a new role from an existing project in the solution.

But it cannot identity this project as a Web Role:

Add Web Role Project in solution...

How are we able to host a ASP.NET 5 project in a Azure Web Role?

Edit: We are using Azure SDK 2.7

like image 214
Dave New Avatar asked Jul 28 '15 06:07

Dave New


People also ask

Is .NET 5 supported in Azure?

To support . NET 5, Azure Functions introduces a new isolated process model that runs . NET function apps in a separate worker process outside the Azure Functions host runtime.

How do I convert my web application to Azure?

Receive step-by-step guidance for modernising your SQL Server data on Azure. Download and install the Data Migration Assistant. Perform a SQL Server migration assessment of your data. Use the Azure Database Migration Service to easily migrate your data, schema, and objects from on-premises to the cloud at scale.

Can asp net used with Azure?

ASP.NET web apps are cross-platform and can be hosted on Linux or Windows. When you're finished, you'll have an Azure resource group consisting of an App Service hosting plan and an App Service with a deployed web application.


2 Answers

Sorry, we don't support WebRoles at the moment. You might* be able to hack your way around but officially there is no support. That means that any hack you do, will be in a text editor, not from tooling.

However, you can use an Azure WebSite instead. That's fully supported.

* it might not work at all. I am not aware of anyone who did this.

like image 162
Victor Hurdugaci Avatar answered Sep 27 '22 20:09

Victor Hurdugaci


You probably have to build your package yourself using CSPack. Here an example using PowerShell and CSPack:

# path to cspack
$cspackPath = Join-Path $env:ProgramFiles 'Microsoft SDKs\Azure\.NET SDK\v2.7\bin\cspack.exe'

$PackagePath = 'c:\mycloudpackage.cspkg'
$serviceDefinitionFile = 'c:\myProject\ServiceDefinition.csdef'
$webRoleName = 'MyWebRole'
$webRolePath = 'c:\myProject'
$webRoleEntryPoint = 'MyWebRole.dll'

# define the cspack parameters
$cspackParameter = @(
        "/out:$PackagePath",
        $serviceDefinitionFile,
        "/role:$webRoleName;$webRolePath;$webRoleEntryPoint",
        "/sites:$webRoleName;Web;$webRolePath"
    )

# execute cspack
& $cspackExe @cspackParameter

It also allows you to host multiple sites on a single web role.

like image 21
Martin Brandl Avatar answered Sep 27 '22 19:09

Martin Brandl