ASP.NET 5 web application as Azure Web Role?

后端 未结 5 1620
我寻月下人不归
我寻月下人不归 2021-02-19 18:15

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:51

    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.

提交回复
热议问题