我正在尝试在单个exe(ServiceRuntime.RegisterServiceAsync)中注册多个服务结构服务.这支持吗?如果是这样,我将如何配置它们?
例如:ServiceManifest.xml支持ServiceTypes中的多个StatelessServiceType元素:
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="EchoGatewayPkg"
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="Service1Type" >
</StatelessServiceType>
<StatelessServiceType ServiceTypeName="Service2Type" >
</StatelessServiceType>
</ServiceTypes>
...
Run Code Online (Sandbox Code Playgroud)
和ApplicationManifest.xml不支持DefaultServices/Service中的多个StatelessService元素:
<?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="EchoServiceType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="Service1_InstanceCount" DefaultValue="1" />
<Parameter Name="Service2_InstanceCount" DefaultValue="1" />
</Parameters>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="MyServicePkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides />
</ServiceManifestImport>
<DefaultServices>
<Service Name="MyService1">
<StatelessService ServiceTypeName="Service1Type" InstanceCount="[Service1_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
<Service Name="MyService2">
<StatelessService ServiceTypeName="Service2Type" InstanceCount="[Service2_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
</DefaultServices>
</ApplicationManifest>
Run Code Online (Sandbox Code Playgroud)
因此,这有效地产生了2个进程,并且每个进程的激活上下文都列出了两种默认服务类型(我预计只有一个具有此配置).
欢迎任何建议(关于如何在单个exe中配置多个服务类型)或澄清.