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:
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?