2017-08-16 126 views
0

我有反向代理本地和部署集群上配置正确,但荫无法访问此反向代理端口上我owin基础的WebAPI是我得到这个端口 enter image description here服务织物反向代理服务器不工作

我的回应已遵循this link,并确定其配置正确。问题是我是否需要改变我的项目或代码中的某些内容才能使其工作。 这里是我的服务清单为的WebAPI:

<?xml version="1.0" encoding="utf-8"?> 
<ServiceManifest Name="BimWebApiPkg" 
       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="BimWebApiType" /> 
    </ServiceTypes> 

    <!-- Code package is your service executable. --> 
    <CodePackage Name="Code" Version="1.0.9"> 
    <EntryPoint> 
     <ExeHost> 
     <Program>BimWebApi.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.9" /> 

    <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="80" /> 

    </Endpoints> 
    </Resources> 
</ServiceManifest> 

我也试过不指定任何端口,但同样没有奏效。

+0

看到这里https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy#uri-format-for-addressing-services-by -using-the-reverse-proxy – Mardoxx

+0

特别是'ServiceInstanceName:这是您试图在没有“fabric:/”方案的情况下到达的已部署服务实例的完全限定名称。例如,要访问结构:/ myapp/myservice/service,您可以使用myapp/myservice.' – Mardoxx

回答

1

似乎url不正确。它缺少应该指定应用程序名称和服务名称的部分。试试这个 -

http://localhost:19081/YOUR_APP_NAME/BimWebApi/api/TestAPI/GetString/

+0

是的,我也想到了同样的东西,有没有办法从url中去掉YOUR_APP_NAME/BimWebApi? – Kayani

+1

@Kayani如果您想使用反向代理,则不需要。它需要应用程序和服务名称来解析发送请求的节点。另一方面,您可以尝试SF DNS服务。查看[Azure服务结构中的DNS服务](https://docs.microsoft.com/zh-cn/azure/service-fabric/service-fabric-dnsservice)。 –