Azure service fabric 服务结构:注册ServiceFabricApplication类型;环境变量不能包含文本";错误

Azure service fabric 服务结构:注册ServiceFabricApplication类型;环境变量不能包含文本";错误,azure-service-fabric,Azure Service Fabric,我正在尝试用我的本地服务结构注册一个小的测试容器应用程序 我可以使用copy ServiceFabricApplicationPackage ok将应用程序包复制到映像存储中,但只要我尝试使用register ServiceFabricApplicationType注册应用程序,就会出现以下错误: Register-ServiceFabricApplicationType : Exception while parsing XML file: C:\SfDevCluster\Data\Image

我正在尝试用我的本地服务结构注册一个小的测试容器应用程序

我可以使用copy ServiceFabricApplicationPackage ok将应用程序包复制到映像存储中,但只要我尝试使用register ServiceFabricApplicationType注册应用程序,就会出现以下错误:

Register-ServiceFabricApplicationType : Exception while parsing XML file:
C:\SfDevCluster\Data\ImageBuilderProxy\AppType\1e52a632-c74a-4afa-8a93- 
022bc858e7b3\ReverseSvcPkg\ServiceManifest.xml
FileName:
C:\SfDevCluster\Data\ImageBuilderProxy\AppType\1e52a632-c74a-4afa-8a93- 
022bc858e7b3\ReverseSvcPkg\ServiceManifest.xml
--> InvalidOperationException: There is an error in XML document (20, 56). -- 
> XmlSchemaValidationException: The
element 'EnvironmentVariables' in namespace 
'http://schemas.microsoft.com/2011/01/fabric' cannot contain text. List of
possible elements expected: 'EnvironmentVariable' in namespace 
'http://schemas.microsoft.com/2011/01/fabric'.
At line:1 char:1
+ Register-ServiceFabricApplicationType myapp
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo          : InvalidOperation: 
(Microsoft.Servi...usterConnection:ClusterConnection) [Register-Servic
eFabricApplicationType], FabricException
+ FullyQualifiedErrorId : 


RegisterApplicationTypeErrorId, Microsoft.ServiceFabric.Powershell.RegisterApplicationType
ApplicationManifest.xml文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest  ApplicationTypeName="myappType" ApplicationTypeVersion="1.0.0"
                      xmlns="http://schemas.microsoft.com/2011/01/fabric" 
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <ServiceManifestImport>
      <ServiceManifestRef ServiceManifestName="MySvcSvcPkg" ServiceManifestVersion="1.0.0" />
        <Policies>
            <ContainerHostPolicies CodePackageRef="Code">
                <PortBinding ContainerPort="9191" EndpointRef="MySvcSvcEndpoint"/>
            </ContainerHostPolicies>
        </Policies>
   </ServiceManifestImport>

   <DefaultServices>
      <Service Name="ReversSvc">
         <StatelessService ServiceTypeName="MySvcSvcType" InstanceCount="1">
            <SingletonPartition />
         </StatelessService>
      </Service>
   </DefaultServices>

</ApplicationManifest>
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="MySvcSvcPkg" Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric" 
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

   <ServiceTypes>
      <StatelessServiceType ServiceTypeName="MySvcSvcType" UseImplicitHost="true">
   </StatelessServiceType>
   </ServiceTypes>

   <CodePackage Name="code" Version="1.0.0">
      <EntryPoint>
         <ContainerHost>
            <ImageName>xxxxxxxxxxx/MySvc:latest</ImageName>
            <Commands></Commands>
         </ContainerHost>
      </EntryPoint>
      <EnvironmentVariables>
        <EnvironmentVariable Name="PORT" Value="9191"/>
      </EnvironmentVariables>
   </CodePackage>
   <Resources>
        <Endpoints>
            <Endpoint Name="MySvcSvcEndpoint" UriScheme="http" Port="9191" Protocol="http"/>
        </Endpoints>
    </Resources>
 </ServiceManifest>

ServiceManifest.xml如下所示:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest  ApplicationTypeName="myappType" ApplicationTypeVersion="1.0.0"
                      xmlns="http://schemas.microsoft.com/2011/01/fabric" 
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <ServiceManifestImport>
      <ServiceManifestRef ServiceManifestName="MySvcSvcPkg" ServiceManifestVersion="1.0.0" />
        <Policies>
            <ContainerHostPolicies CodePackageRef="Code">
                <PortBinding ContainerPort="9191" EndpointRef="MySvcSvcEndpoint"/>
            </ContainerHostPolicies>
        </Policies>
   </ServiceManifestImport>

   <DefaultServices>
      <Service Name="ReversSvc">
         <StatelessService ServiceTypeName="MySvcSvcType" InstanceCount="1">
            <SingletonPartition />
         </StatelessService>
      </Service>
   </DefaultServices>

</ApplicationManifest>
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="MySvcSvcPkg" Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric" 
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

   <ServiceTypes>
      <StatelessServiceType ServiceTypeName="MySvcSvcType" UseImplicitHost="true">
   </StatelessServiceType>
   </ServiceTypes>

   <CodePackage Name="code" Version="1.0.0">
      <EntryPoint>
         <ContainerHost>
            <ImageName>xxxxxxxxxxx/MySvc:latest</ImageName>
            <Commands></Commands>
         </ContainerHost>
      </EntryPoint>
      <EnvironmentVariables>
        <EnvironmentVariable Name="PORT" Value="9191"/>
      </EnvironmentVariables>
   </CodePackage>
   <Resources>
        <Endpoints>
            <Endpoint Name="MySvcSvcEndpoint" UriScheme="http" Port="9191" Protocol="http"/>
        </Endpoints>
    </Resources>
 </ServiceManifest>

xxxxxxxxxx/MySvc:最新版本
      

据我所知,这是符合规范的,所以我不知道为什么会出现错误。

你检查过标签周围是否有任何不可靠的字符吗
?是的,我检查过,没有不可靠的字符。我将从全新的项目开始,这个配置没有问题。@SteppingRazor,这就是我最后要做的。我重新生成了配置,一切正常。