Search code examples
azure-service-fabric

Service Fabric App Deployment Not Creating Service


When I deploy my service fabric app to my local cluster via Visual Studio 2017, my service is not getting created. I have to manually go into the Service Fabric Explorer and click create. Why?

cluster management screenshot


Background: I did some project re-naming and moving folders around. I think that broke this as it used to work.


Output Window of Service Fabric Tools

Started executing script 'Publish-NewServiceFabricApplication'.
[void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; Publish-NewServiceFabricApplication -ApplicationPackagePath 'C:\Users\mdepouw\source\repos\The Repo\TheProject.IdentityDomain\TheProject.Identity.App\pkg\Debug' -ApplicationParameterFilePath 'C:\Users\mdepouw\source\repos\The Repo\TheProject.IdentityDomain\TheProject.Identity.App\PublishProfiles\..\ApplicationParameters\Local.5Node.xml' -ApplicationParameter @{_WFDebugParams_='[{"""CodePackageName""":"""Code""","""CodePackageLinkFolder""":null,"""ConfigPackageName""":null,"""ConfigPackageLinkFolder""":null,"""DataPackageName""":null,"""DataPackageLinkFolder""":null,"""LockFile""":null,"""WorkingFolder""":null,"""ServiceManifestName""":"""IdentityServicePkg""","""EntryPointType""":"""Main""","""DebugExePath""":"""C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Packages\\Debugger\\VsDebugLaunchNotify.exe""","""DebugArguments""":""" {83288f71-0cb5-49bc-b56b-f212d6fc8486} -p [ProcessId] -tid [ThreadId]""","""DebugParametersFile""":null}]'} -Action Create -SkipPackageValidation:$true -ErrorAction Stop
Creating application...


ApplicationName        : fabric:/IdentityApp
ApplicationTypeName    : IdentityAppType
ApplicationTypeVersion : 1.0.0
ApplicationParameters  : { "_WFDebugParams_" = "[{"CodePackageName":"Code","CodePackageLinkFolder":null,"ConfigPackageN
                         ame":null,"ConfigPackageLinkFolder":null,"DataPackageName":null,"DataPackageLinkFolder":null,"
                         LockFile":null,"WorkingFolder":null,"ServiceManifestName":"IdentityServicePkg","EntryPointType
                         ":"Main","DebugExePath":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\C
                         ommon7\\Packages\\Debugger\\VsDebugLaunchNotify.exe","DebugArguments":" 
                         {83288f71-0cb5-49bc-b56b-f212d6fc8486} -p [ProcessId] -tid 
                         [ThreadId]","DebugParametersFile":null}]" }

Create application succeeded.


Finished executing script 'Publish-NewServiceFabricApplication'.
Time elapsed: 00:00:07.2779519
Started executing script 'Get-ServiceFabricApplicationStatus'.
[void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; Get-ServiceFabricApplicationStatus -ApplicationName 'fabric:/IdentityApp' -ErrorAction Stop
The application has started.
Service Status:

The application is ready.
Finished executing script 'Get-ServiceFabricApplicationStatus'.
Time elapsed: 00:00:04.7490158
Launching the browser with URL https://localhost:44300/ to open the application.Started executing script 'Unpublish-ServiceFabricApplication'.
[void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; Unpublish-ServiceFabricApplication -ApplicationName 'fabric:/IdentityApp' -ErrorAction Stop
Removing application...
Remove application instance succeeded
Finished executing script 'Unpublish-ServiceFabricApplication'.
Time elapsed: 00:00:08.9813491
Started executing script 'UnregisterApplicationType'.
[void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; if (Get-ServiceFabricApplicationType -ApplicationTypeName 'IdentityAppType' | Where-Object { $_.ApplicationTypeVersion -eq '1.0.0' }) { Unregister-ServiceFabricApplicationType -ApplicationTypeName 'IdentityAppType' -ApplicationTypeVersion '1.0.0' -ErrorAction Stop -Force }
Unregister application type succeeded.
Finished executing script 'UnregisterApplicationType'.
Time elapsed: 00:00:07.9996788
Launching the browser with URL https://localhost:44300/ to open the application.

Solution

  • In ApplicationManifest.xml I had to define the <DefaultServices> I wanted:

    <DefaultServices>
        <!-- The section below creates instances of service types, when an instance of this 
             application type is created. You can also create one or more instances of service type using the 
             ServiceFabric PowerShell module.
    
             The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
        <Service Name="Identity">
          <StatelessService ServiceTypeName="IdentityService" InstanceCount="[Identity_InstanceCount]">
            <SingletonPartition />
          </StatelessService>
        </Service>
    </DefaultServices>