6

I created a Service Fabric application with a normal stateless service and a stateless ASP.NET Core web application. Without changing any of the default code I tried to deploy the application. During deployment an error occured:

Register-ServiceFabricApplicationType : The BuildLayout of the application in
C:\SfDevCluster\Data\ImageBuilderProxy\AppType\AadMockApplicationType is invalid. Code is missing for service
TenantWebServerPkg.

After inspecting my package I noticed that the package did not include the code but only the service manifest file and the configuration package:

enter image description here

My web application service manifest:

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="TenantWebServerPkg"
                 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>
    <!-- This is the name of your ServiceType. 
         This name must match the string used in RegisterServiceType call in Program.cs. -->
    <StatelessServiceType ServiceTypeName="TenantWebServerType" />
  </ServiceTypes>

  <!-- Code package is your service executable. -->
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>TenantWebServer.exe</Program>
        <WorkingFolder>CodePackage</WorkingFolder>
      </ExeHost>
    </EntryPoint>
  </CodePackage>

  <!-- Config package is the contents of the Config directoy under PackageRoot that contains an 
       independently-updateable and versioned set of custom configuration settings for your service. -->
  <ConfigPackage Name="Config" Version="1.0.0" />

  <Resources>
    <Endpoints>
      <!-- This endpoint is used by the communication listener to obtain the port on which to 
           listen. Please note that if your service is partitioned, this port is shared with 
           replicas of different partitions that are placed in your code. -->
      <Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="8396" />
    </Endpoints>
  </Resources>
</ServiceManifest>

After trying for many hours I noticed that the code package is published to a different folder: C:\Users\username\AppData\Local\Temp\PublishTemp\TenantWebServer118

How do I package the web application correctly so the code package is included?

Wouter B
  • 731
  • 5
  • 16
  • What's in your service manifest? – Mardoxx Aug 12 '17 at 09:05
  • @Mardoxx I added my service manifest. – Wouter B Aug 21 '17 at 07:02
  • I also noticed that the code package does exist, but is published to the AppData\Temp\PublishTemp folder. – Wouter B Aug 21 '17 at 07:12
  • I've tried to create the same projects and VS2017 builds valid package with `Code` folder included. Let's try to find out what is the difference between our environments. Do you use VS2015 or VS2017? If VS2015, do you have a chance to check it under VS2017? – CodeFuller Jan 24 '18 at 06:29
  • How do you build the package? Through `Package` in project context menu? The one thing that confuses me is that in you directory listing `Stateless1Pkg` and `TenantWebServerPkg` are placed under one `PKG\DEBUG` directory. In my case they are placed under separate directories within the project, e.g. `Stateless1Pkg\pkg\Debug\Stateless1Pkg` and `TenantWebServerPkg\pkg\Debug\TenantWebServerPkg`. Do you have an idea why they are under the same `pkg\Debug` directory in your case? May be you made some specific customization to achieve that? – CodeFuller Jan 24 '18 at 06:31

1 Answers1

2

Note: The .NET Core tools for Visual Studio 2015 are no longer being updated, however if you are still using Visual Studio 2015, you need to have .NET Core VS 2015 Tooling Preview 2 installed.

As stated in Microsoft docs:

To develop ASP.NET Core Service Fabric applications, you should have the following workloads installed:

  • Azure development (under Web & Cloud)
  • ASP.NET and web development (under Web & Cloud)
  • .NET Core cross-platform development (under Other Toolsets)

Updated:

Question: Why the code package is published to a different folder?

Answer: Example (Powershell) Register an application type

PS C:\> Copy-ServiceFabricApplicationPackage -ApplicationPackagePath "c:\work\PersistentToDoListService" -ImageStoreConnectionString "file:C:\SfDevCluster\Data\ImageStoreShare" -ApplicationPackagePathInImageStore "PersistentToDoListService"
PS C:\> Register-ServiceFabricApplicationType -ApplicationPathInImageStore "PersistentToDoListService"

Copy-ServiceFabricApplicationPackage copies the application package found in the "c:\work\PersistentToDoListService" folder to the image store. The package is copied at the relative path "PersistentToDoListService" in image store.

Register-ServiceFabricApplicationType command registers the application type found in the relative path "PersistentToDoListService".