我有一个服务结构集群在本地工作正常但在部署到azure时,WebAPI无状态服务返回
404 FABRIC_E_SERVICE_DOES_NOT_EXISTS
然而,SF群集显示该服务确实存在且已启动并正在运行 以下是我服务的服务清单
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="SvcWebAPIPkg"
Version="1.0.9"
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="SvcWebAPIType" />
</ServiceTypes>
<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="1.0.9">
<EntryPoint>
<ExeHost>
<Program>SvcWebApi.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>
<ConfigPackage Name="Config" Version="1.0.9" />
<Resources>
<Endpoints>
<Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input"
Port="80" />
</Endpoints>
</Resources>
</ServiceManifest>
答案 0 :(得分:0)
如果这是您访问服务的方式 - &#34; myaddress.com/api/BriefcaseApi/GetString" - 这不对。 SF试图解决“api”问题。作为注册服务,显然不存在。对?以下是构建URL的方法 -
http(s)://<Cluster FQDN | internal IP>:Port/<ServiceInstanceName>/<Suffix path>?PartitionKey=<key>&PartitionKind=<partitionkind>&ListenerName=<listenerName>&TargetReplicaSelector=<targetReplicaSelector>&Timeout=<timeout_in_seconds>
在你的情况下,这是它的样子 -
HTTP(S)://myaddress.com/SvcWebAPI/api/BriefcaseApi/GetString
在此处查找更多信息 - Reverse proxy in Azure Service Fabric。