【发布时间】:2018-01-19 15:01:18
【问题描述】:
我创建了一个带有普通无状态服务和无状态 ASP.NET Core Web 应用程序的 Service Fabric 应用程序。在不更改任何默认代码的情况下,我尝试部署应用程序。部署过程中发生错误:
Register-ServiceFabricApplicationType :
中应用程序的BuildLayout C:\SfDevCluster\Data\ImageBuilderProxy\AppType\AadMockApplicationType 无效。缺少服务代码
TenantWebServerPkg。
检查我的包后,我注意到包中没有代码,只有服务清单文件和配置包:
我的网络应用服务清单:
<?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>
尝试了几个小时后,我注意到代码包被发布到不同的文件夹:C:\Users\username\AppData\Local\Temp\PublishTemp\TenantWebServer118
如何正确打包 Web 应用程序以便包含代码包?
【问题讨论】:
-
您的服务清单中有什么?
-
@Mardoxx 我添加了我的服务清单。
-
我也注意到代码包确实存在,但是发布到了AppData\Temp\PublishTemp文件夹中。
-
我尝试创建相同的项目,VS2017 构建了包含
Code文件夹的有效包。让我们尝试找出我们的环境之间的区别。你用的是VS2015还是VS2017?如果是VS2015,有机会在VS2017下查看吗? -
如何构建包?通过项目上下文菜单中的
Package?让我感到困惑的一件事是,在您的目录列表中Stateless1Pkg和TenantWebServerPkg被放在一个PKG\DEBUG目录下。在我的情况下,它们被放置在项目中的单独目录下,例如Stateless1Pkg\pkg\Debug\Stateless1Pkg和TenantWebServerPkg\pkg\Debug\TenantWebServerPkg。您知道为什么它们在您的情况下位于同一pkg\Debug目录下吗?您是否可以进行一些特定的定制来实现这一目标?
标签: c# asp.net azure-service-fabric service-fabric-stateless