服务结构托管Asp.net WebApi容器应用程序:403 - 禁止访问:访问被拒绝。在本地群集上

问题描述 投票:3回答:1

我正在尝试升级和转移Asp.net MVC应用程序。我已经包含了我的Asp.Net WebApi应用程序并部署了AzureContainerRegistry,我在服务结构应用程序中引用了容器。我的ServiceManifest看起来像这样

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="BookingApiServicePkg"
                 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>
    <StatelessServiceType ServiceTypeName="BookingApiServiceType" UseImplicitHost="true" />
  </ServiceTypes>


  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ContainerHost>
        <ImageName>bookingacr.azurecr.io/bookingapi</ImageName>
      </ContainerHost>
    </EntryPoint>
  </CodePackage>

  <ConfigPackage Name="Config" Version="1.0.0" />    
  <Resources>
    <Endpoints>
      <Endpoint Name="BookingApiServiceTypeEndpoint"   Port="62651"  UriScheme="http" Protocol="http"/>
    </Endpoints>
  </Resources>
</ServiceManifest>

应用程序清单看起来像这样

<ApplicationManifest ApplicationTypeName="BookingApiType"
                     ApplicationTypeVersion="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">
  <Parameters>
    <Parameter Name="BookingApiService_InstanceCount" DefaultValue="-1" />
  </Parameters>     
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="BookingApiServicePkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides />
    <Policies>
      <ContainerHostPolicies CodePackageRef="Code" ContainersRetentionCount="2"  RunInteractive="true">
        <HealthConfig IncludeDockerHealthStatusInSystemHealthReport="true" RestartContainerOnUnhealthyDockerHealthStatus="false" />
        <PortBinding ContainerPort="80" EndpointRef="BookingApiServiceTypeEndpoint" />
      </ContainerHostPolicies>
    </Policies>
  </ServiceManifestImport>
  <DefaultServices>   
    <Service Name="BookingApiService" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="BookingApiServiceType"  InstanceCount="[BookingApiService_InstanceCount]">
        <SingletonPartition />
      </StatelessService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

生成的Url是MachineName:PortNumber(http://desktopm423:62651on我的本地系统),但访问它时显示

403 - 禁止访问:访问被拒绝。

当部署到Service Fabric实例时,我得到一个IP地址,消息是

无法提供服务

asp.net-mvc docker asp.net-web-api azure-service-fabric azure-container-registry
1个回答
0
投票

看起来您有证书服务结构证书问题,您必须在计算机本地Cert / root和所有当前用户证书中添加所有证书

只要您不配置任何管理客户端证书,您对资源管理器(:19080 / Explorer)的所有请求都将以403结尾。

您可以在门户中添加管理客户端证书的指纹:

enter image description here

以下是相同的ARM设置: -

{
  "type": "Microsoft.ServiceFabric/clusters",
  ...
  "properties": {
    ...
    "ClientCertificateThumbprints": [
      {
        "CertificateThumbprint": "THUMBPRINT_HERE",
        "IsAdmin": true
      }
    ],
  ...
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.