Powershell 错误:需要为虚拟路径指定物理目录';网络/';角色
我在这里遵循这个问题底部的答案:因为我正在尝试为asp.net核心构建一个azure web角色 当我运行powershell脚本时,会出现以下错误: 错误CloudServices077:需要为角色的虚拟路径“Web/”指定物理目录 如果有人知道在asp.NETCore中使用azure web角色的另一种方法,那么我也完全赞成 我正在使用CSPack尝试并配置它 Powershell脚本:Powershell 错误:需要为虚拟路径指定物理目录';网络/';角色,powershell,azure,asp.net-core,Powershell,Azure,Asp.net Core,我在这里遵循这个问题底部的答案:因为我正在尝试为asp.net核心构建一个azure web角色 当我运行powershell脚本时,会出现以下错误: 错误CloudServices077:需要为角色的虚拟路径“Web/”指定物理目录 如果有人知道在asp.NETCore中使用azure web角色的另一种方法,那么我也完全赞成 我正在使用CSPack尝试并配置它 Powershell脚本: # path to cspack $cspackPath = Join-Path $env:Progra
# path to cspack
$cspackPath = Join-Path $env:ProgramFiles 'Microsoft SDKs\Azure\.NET SDK\v2.8\bin\cspack.exe'
$PackagePath = 'I:\Users\MyUserName\Documents\visual studio 2015\Projects\SoundVast\SoundVast.Azure\SoundVast.cspkg'
$serviceDefinitionFile = 'I:\Users\MyUserName\Documents\visual studio 2015\Projects\SoundVast\SoundVast.Azure\ServiceDefinition.csdef'
$webRoleName = 'WebRole1'
$webRolePath = 'I:\Users\MyUserName\Documents\visual studio 2015\Projects\SoundVast\SoundVast.Azure'
# define the cspack parameters
$cspackParameter = @(
$serviceDefinitionFile,
"/role:$webRoleName;$webRolePath;",
"/sites:$webRoleName;SoundVast;$webRolePath",
"/out:$PackagePath"
)
# execute cspack
& $cspackPath @cspackParameter
ServiceDefinition.csdef
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="SoundVast.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="WebRole1" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
</WebRole>
</ServiceDefinition>
ServiceConfiguration.Cloud和ServiceConfiguration.Local
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="SoundVast.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">
<Role name="WebRole1">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
文件夹结构(如果有区别…)
我在这一行中缺少phsycial目录:
。在此之后,我运行脚本,它为我创建了一个包。这方面的文档确实不好
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="SoundVast.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="WebRole1" vmsize="Small">
<Sites>
<Site name="Web" physicalDirectory="../SoundVast">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
</WebRole>
</ServiceDefinition>