ASP.NET 5 web application as Azure Web Role?

后端 未结 5 1410
既然无缘
既然无缘 2021-02-19 18:00

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 t

5条回答
  •  既然无缘
    2021-02-19 18:41

    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.

提交回复
热议问题