需要一些帮助来理解为什么服务矩阵应用程序的配置设置不会像预期的那样被应用程序清单中定义的值覆盖。目前,我已经为两个不同的环境定义了一些设置:默认设置用于最终的Azure群集,而我的本地开发群集具有自定义的发布配置文件。
在每个文件下面,我都有
:SampleServFabricApp / ApplicationPackageRoot / ApplicationManifest.xml
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="SampleServFabricAppType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateFindValue" DefaultValue="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
<Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames" DefaultValue="*.thefinaldomain.com" />
<Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints" DefaultValue="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
<Parameter Name="SampleServFabricApp_PartitionCount" DefaultValue="10" />
<Parameter Name="SampleServFabricApp_MinReplicaSetSize" DefaultValue="3" />
<Parameter Name="SampleServFabricApp_TargetReplicaSetSize" DefaultValue="3" />
</Parameters>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="SampleServFabricApp.EndpointPkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides>
<ConfigOverride Name="Config">
<Settings>
<Section Name="SampleServFabricApp_MessageTransportConfig">
<Parameter Name="CertificateFindValue" Value="[SampleServFabricApp_MessageTransportConfig_CertificateFindValue]" />
<Parameter Name="CertificateRemoteCommonNames" Value="[SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames]" />
<Parameter Name="CertificateRemoteThumbprints" Value="[SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints]" />
</Section>
</Settings>
</ConfigOverride>
</ConfigOverrides>
</ServiceManifestImport>
<DefaultServices>
<Service Name="SampleServFabricAppActorService" GeneratedIdRef="e07529c2-2426-4065-b621-90033a78704c|Persisted">
<StatefulService ServiceTypeName="SampleServFabricAppActorServiceType" TargetReplicaSetSize="[SampleServFabricApp_TargetReplicaSetSize]" MinReplicaSetSize="[SampleServFabricApp_MinReplicaSetSize]">
<UniformInt64Partition PartitionCount="[SampleServFabricApp_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
</StatefulService>
</Service>
</DefaultServices>
</ApplicationManifest>
SampleServFabricApp / ApplicationParameters / dev_cluster.xml
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/SampleServFabricApp" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateFindValue" Value="4826f9a3ac95bca949fab19ea136e197" />
<Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames" Value="ServiceFabricDevClusterCert" />
<Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints" Value="4826f9a3ac95bca949fab19ea136e197" />
</Parameters>
</Application>
SampleServFabricApp.Endpoint / PackageRoot / Config / Settings.xml
<?xml version="1.0" encoding="utf-8"?>
<Settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Section Name="SampleServFabricApp_MessageTransportConfig">
<Parameter Name="MaxMessageSize" Value="10000000" />
<Parameter Name="SecurityCredentialsType" Value="X509" />
<Parameter Name="CertificateFindType" Value="FindByThumbprint" />
<Parameter Name="CertificateFindValue" Value="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
<Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
<Parameter Name="CertificateStoreName" Value="My" />
<Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
<Parameter Name="CertificateRemoteCommonNames" Value="*.thefinaldomain.com" />
<Parameter Name="CertificateRemoteThumbprints" Value="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
</Section>
</Settings>
将应用程序发布到本地集群时,我可以在输出中看到创建应用程序时的日志,并且看来参数还可以:
2>正在创建应用程序... 2> 2> 2> ApplicationName: fabric:/ SampleServFabricApp 2> ApplicationTypeName: SampleServFabricAppType 2> ApplicationTypeVersion:1.0.0 2> ApplicationParameters:{ “ SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints” = 2>“ 4826f9a3ac95bca949fab19ea136e197”; 2>“ SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames” = 2>“ ServiceFabricDevClusterCert”; 2>“ SampleServFabricApp_MessageTransportConfig_CertificateFindValue” = 2>“ 4826f9a3ac95bca949fab19ea136e197”; } 2> 2>创建应用程序成功。
但是使用服务浏览器,我可以看到在应用程序启动期间发生了错误,并且如果查看事件日志,我可以看到以下错误:
无法将安全设置设置为{provider = SSL protection = EncryptAndSign certType =''store ='LocalMachine / My' findValue ='FindByThumbprint:e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764' remoteCertThumbprints ='e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764' remoteX509Names =('*。thefinaldomain.com',issuer =) certChainFlags = 40000000 isClientRoleInEffect = false ClaimsBasedClientAuthEnabled = false}:FABRIC_E_CERTIFICATE_NOT_FOUND
我已经尝试过的一些方法: -使用了Service Fabric资源管理器,并确认应用程序的“详细信息”选项卡下的“参数”正确无误,并且已根据“输出”窗口匹配已发送到部署脚本的参数; -确认“ C:\ SfDevCluster \ Data_App_Node_0 \ SampleServFabricAppType_App18 \ SampleServFabricApp.EndpointPkg.Config.1.0.0”下的“ Settings.xml”文件的内容与“ SampleServFabricApp.Endpoint / PackageRoot / Config / Settings.xml”;
您知道这是一个错误还是丢失了我真正看不到的东西? 如您所见,部署过程似乎采用了正确的覆盖值,但是应用程序无法正常工作,事件查看器显示的是默认值,而不是部署期间使用的默认值。
谢谢。