2016-07-25 27 views
0

我在这里回答这个问题的底部:ASP.NET 5 web application as Azure Web Role?,因为我正在为asp.net构建一个azure web角色核心。错误:需要指定虚拟路径'Web /'角色的物理目录

当我运行PowerShell脚本我得到的错误:

Error CloudServices077: Need to specify the physical directory for the virtual path 'Web/' of role

如果有人知道另一种方式来使用asp.net核心蔚蓝的Web角色,然后我完全支持这一点。

我正在使用CSPack来尝试配置它。

PowerShell脚本:

# 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> 

的文件夹结构(如果它的确与众不同...) enter image description here

回答

1

我错过了这一行的phsycial目录:<Site name="Web" physicalDirectory="../SoundVast">。在此之后,我运行脚本并为我创建了一个包。关于这个文件真的不好。

<?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> 
相关问题