Service Fabric doesn't published application if LoadMetric is specified in ServiceManifest.xml - azure-service-fabric

I have specified in ServiceManifest.xml the LoadMetric CommunicationCount:
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="StatelessWcfNetPkg"
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="StatelessWcfNetType" >
<LoadMetrics>
<LoadMetric Name="ConnectionCount" DefaultLoad="1" SecondaryDefaultLoad="1" Weight="High"/>
</LoadMetrics>
</StatelessServiceType>
</ServiceTypes>
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ExeHost>
<Program>StatelessWcfNet.exe</Program>
</ExeHost>
</EntryPoint>
</CodePackage>
<ConfigPackage Name="Config" Version="1.0.0" />
<Resources>
<Endpoints>
<Endpoint Name="ServiceEndpoint" />
</Endpoints>
</Resources>
</ServiceManifest>
It was built, but by publish I had an error:
4>Creating application...
4>New-ServiceFabricApplication : An error occurred during this operation. Please check the trace logs for more details.
4>In C:\Program Files\Microsoft SDKs\Service
4>Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:358 Zeichen:9
4>+ New-ServiceFabricApplication -ApplicationName $ApplicationNam ...
4>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4> + CategoryInfo : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [New-ServiceFabr
4> icApplication], FabricException
4> + FullyQualifiedErrorId : CreateApplicationInstanceErrorId,Microsoft.ServiceFabric.Powershell.NewApplication
4>
Without LoadMetric-tag, everything is fine. What doing I wrong?

The value of SecondaryDefaultLoad must be 0 or it shouldn't be appeared. I don't know why...

Related

[Wix][PostgreSQL] How to add an install condition in bundle

I'm trying to add a condition before installing PostgreSQL on Wix bundle.
I'm expecting it to check if there is an installed version of PostgreSQL as you can see on my following code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Title" Version="1.0.0.0" Manufacturer="Manufacture" UpgradeCode="5aee5af2-10c7-42d1-bde6-c7dadf736786">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
<?define InstallPgCommand=--unattendedmodeui minimal --mode unattended --superpassword "super_pwd" --servicename "service_name" --servicepassword "service_pwd" --serverport 5433?>
<Chain>
<!-- Install postgres -->
<ExePackage
SourceFile="ThirdPartyApps\postgresql-14.3-1-windows-x64.exe"
Compressed ="yes"
Vital ="yes"
Permanent ="yes"
InstallCommand="$(var.InstallPgCommand)"
InstallCondition="NOT POSTGRESINSTALLED"
/>
</Chain>
</Bundle>
<Fragment>
<Property Id="POSTGRESINSTALLED">
<RegistrySearch Id="POSTGRESINSTALLED_SEARCH" Key="SOFTWARE\PostgreSQL\Installations\postgresql-x64-14" Root="HKLM" Type="raw" Name="Branding" />
</Property>
</Fragment>
</Wix>
But it didn't work as expect.
Can you tell me what I'm doing wrong ? Thanks everyone
RegistrySearch is for MSI packages. For bundles, use util:RegistrySearch instead.

The Settings section with name 'Blah' in ConfigOverride 'Config' is invalid. Cannot find a section with the same name

I'm trying to add a new config section to our SF app configuration and it is failing:
Register-ServiceFabricApplicationType : The Settings section with name 'Blah' in ConfigOverride
'Config' is invalid. Cannot find a section with the same name.
Nothing fancy, done this many times before but I'm doing something wrong and I don't see.
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="eBenefits.OrganizationDomainType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="Parameter1" DefaultValue="" />
<Parameter Name="Parameter2" DefaultValue="" />
<Parameter Name="Parameter3" DefaultValue="" />
</Parameters>
<ConfigOverrides>
<ConfigOverride Name="Config">
<Settings>
...
<Section Name="Blah">
<Parameter Name="Parameter1" Value="[Parameter1]" />
<Parameter Name="Parameter2" Value="[Parameter1]" />
<Parameter Name="Parameter3" Value="[Parameter1]" />
</Section>
</Settings>
</ConfigOverride>
</ConfigOverrides>
...
</ApplicationManifest>
Copying application to image store...
Upload to Image Store succeeded
Registering application type...
Register-ServiceFabricApplicationType : The Settings section with name 'Blah' in ConfigOverride
'Config' is invalid. Cannot find a section with the same name.
FileName: C:\SfDevCluster\Data\ImageBuilderProxy\AppType\a2b68765-272d-4477-aad2-f3d4818365c7\ApplicationManifest.xml
At C:\Program Files\Microsoft SDKs\Service
Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:251 char:9
+ Register-ServiceFabricApplicationType -ApplicationPathInImage ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [Register-Servic
eFabricApplicationType], FabricException
+ FullyQualifiedErrorId : RegisterApplicationTypeErrorId,Microsoft.ServiceFabric.Powershell.RegisterApplicationTyp
e
Finished executing script 'Deploy-FabricApplication.ps1'.
Time elapsed: 00:00:39.7598137
The PowerShell script failed to execute.
I forgot to define it in My-Service\PackageRoot\Config\Settings.xml
Reference: Full instructions on adding SF settings
For anyone else who encountered this issue and already have Settings.xml files, you may wish to create a new Settings.xml using the Visual Studio context menu (new xml file) and get rid of the previous one after copying its contents across. For whatever reason Visual Studio did not recognise that I had a Settings.xml file and thus SF was unable to access it.
After doing this everything works.

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

I'm following the answer at the bottom of this question here: ASP.NET 5 web application as Azure Web Role? as I am trying to build an azure web role for asp.net core.
When I run the powershell script I get the error:
Error CloudServices077: Need to specify the physical directory for the virtual path 'Web/' of role
If anyone knows another way to use azure web roles in asp.net core then I am all for that too.
I'm using CSPack to try and configure this.
Powershell Script:
# 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>
Folder structure (if it makes a difference...)
I was missing the phsycial directory on this line: <Site name="Web" physicalDirectory="../SoundVast">. After this I ran the script and it created a package for me. The documentation on this is really not good.
<?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>
I encountered this issue and resolved it by deleting the web role from my cloud service (it was an MVC) and generating a new one. I had made so many modifications it had become messy, so making a new one from scratch solved the issue

CXF wadl2java generate code from grammar

The code generation with for the methods works fine, but it seems to me that the grammar part is omitted because no Pojo and JAXB annotations are generated. Do I have to specify some additional configuration? I used this command: wadl2java.bat -p packagename /path/to/wadl
Here is a snippet of the wadl.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammer>
<xsd:include href="file1.xsd"></xsd:include>
<xsd:include href="file2.xsd"></xsd:include>
<xsd:include href="file3.xsd"></xsd:include>
<xsd:include href="file14.xsd"></xsd:include>
</grammer>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>
....
I found my mistake. There was a typo in the wadl. Previously I used <grammer> but you have to use <grammars>
Now it works.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammars>
<include href="file1.xsd"></xsd:include>
<include href="file2.xsd"></xsd:include>
<include href="file3.xsd"></xsd:include>
<include href="file14.xsd"></xsd:include>
</grammars>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>

Namespace/Mymodule/Block/Item.php file code not accessible on frontend after adding through xml

i am working on a module e.g "Mymodule", in which i need to filter the results. i.e. for Partners i created Partner.php and for Community i created Community.php in
Mymodule/Block/Partner.php
Mymodule/Block/Community.php
Now i wanted to access their code in frontend through Mymodule.XML
<block type="mymodule/partner" ......................... />
but this doesn't work on LIVE SERVER, although it does work on local Wamp server :( ... Any idea ?
Although when i access the default Mymodule.php code in the same and add the code i placed in partner and community file, it does work.
Is there something i am missing ?
First, you have to define the blocks in your module's config.xml:
<config>
<global>
<blocks>
<mymodule>
<class>Namespace_Mymodule_Block</class>
</mymodule>
</blocks>
</global>
</config>
Second, you have to use the right block type in your layout XML:
<block type="mymodule/partner" ......................... />
You must not write ".php" in the block type. Note, that the term "mymodule" has to be the same in the config xml as well as in the block type.
Hope this helps!
I'm not strictly sure how your code would ever have worked. But assuming you haven't built a module before, you'll need a minimum of 3 files.
app/etc/modules/Sonassi_Module.xml
app/code/community/Sonassi/Module/etc/config.xml
app/code/community/Sonassi/Module/Block/Partner.php
In the first file ... app/etc/modules/Sonassi_Module.xml
<?xml version="1.0"?>
<config>
<modules>
<Sonassi_Module>
<active>true</active>
<codePool>community</codePool>
</Sonassi_Module>
</modules>
</config>
In the second file ... app/code/community/Sonassi/Module/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Sonassi_Module>
<version>0.1.0</version>
</Sonassi_Module>
</modules>
<frontend>
<routers>
<module>
<use>standard</use>
<args>
<module>Sonassi_Module</module>
<frontName>module</frontName>
</args>
</module>
</routers>
</frontend>
<global>
<blocks>
<module>
<class>Sonassi_Module_Block</class>
</module>
</blocks>
</global>
</config>
In the third file ... app/code/community/Sonassi/Module/Block/Partner.php
class Sonassi_Module_Block_Partner extends Core_Block_Template
{
}
Then finally, you can then use
<block type="module/partner" ......................... />