Register-ServiceFabricApplicationType:值不能为null。参数名称:source

时间:2017-12-19 14:07:20

标签: azure-service-fabric

我正在尝试在本地运行我的Service Fabric应用程序但是我收到了以下错误:

  

Register-ServiceFabricApplicationType:值不能为空。

     

参数名称:source

在这种情况下,source是什么?为什么它是null

1 个答案:

答案 0 :(得分:1)

ApplicationManifest.xml我定义<EnvironmentOverrides> w /一个<EnvironmentVariable>条目,但我没有在<EnvironmentVariable>中定义ServiceManifest.xml

Sample project to illustrate

<强> ApplicationManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="Application1Type" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="Web1_InstanceCount" DefaultValue="-1" />
    <Parameter Name="OverrideTest" DefaultValue="Do I Get a Useless Error Message?" />
  </Parameters>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="Web1Pkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides />
    <EnvironmentOverrides CodePackageRef="Code">
      <EnvironmentVariable Name="OverrideTest" Value="[OverrideTest]" />
    </EnvironmentOverrides>
  </ServiceManifestImport>
  ....
  </DefaultServices>
</ApplicationManifest>

<强> ServiceManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="Web1Pkg"
                 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="Web1Type" />
  </ServiceTypes>

  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>Web1.exe</Program>
        <WorkingFolder>CodePackage</WorkingFolder>
      </ExeHost>
    </EntryPoint>
    <!--Uncomment the EnvironmentVariables to get rid of Value cannot be null. >Parameter name: source-->
    <!--<EnvironmentVariables>
      <EnvironmentVariable Name="OverrideTest" Value="Uncomment-me to get rid of the error" />
    </EnvironmentVariables>-->
  </CodePackage>
  ...
</ServiceManifest>