我正在研究将WebApi作为容器托管在Service Fabric群集上的情况。我也将MvcWebApp托管为同一Service Fabric群集上的容器。现在,当我尝试使用在ServiceManifest.xml中配置的端口号访问MvcWebApp内部的WebApi时,它将抛出错误“连接被拒绝”。尽管可以在基于非容器的应用程序内部或直接在浏览器上访问它。
It will be helpful if some will give some insight over it.
**WebApi ServiceManifest.xml**
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ContainerHost>
<ImageName>employeeapi:dev</ImageName>
</ContainerHost>
</EntryPoint>
</CodePackage>
<ConfigPackage Name="Config" Version="1.0.0" />
<Resources>
<Endpoints>
<Endpoint Protocol="http" Name="EmployeeApiTypeEndpoint" Type="Input" Port="8092" />
</Endpoints>
</Resources>
**WebApi ApplicationManifest.xml**
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="EmployeeApiPkg" ServiceManifestVersion="1.0.0" />
<EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="ENV_EmployeeService" Value="[EMS_MyEnvironmentVariable]" />
</EnvironmentOverrides>
<Policies>
<ContainerHostPolicies CodePackageRef="Code" Isolation="[EmployeeApi_Isolation]">
<PortBinding ContainerPort="80" EndpointRef="EmployeeApiTypeEndpoint" />
</ContainerHostPolicies>
</Policies>
</ServiceManifestImport>
<DefaultServices>
<Service Name="EmployeeApi" ServicePackageActivationMode="ExclusiveProcess">
<StatelessService ServiceTypeName="EmployeeApiType" InstanceCount="[EmployeeApi_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
</DefaultServices>