我有http://195.50.152.240:23/monitoring.svc/地址提供的wcf服务。此外,我有必须使用我的wcf服务的特殊服务器,但是当我将上面的url设置为wcf-service源时,特殊服务器正在通过另一个URL(例如http://195.50.152.240:23/monitoring.svc/AnalyticalServer/ws)进行寻址。 问题是如何将请求从特殊服务器转发到我的WCF服务?
我对特殊服务器一无所知,只知道它转换了请求(wireshark规则) WCF服务由IIS 8.5托管 在WCF的web.config中指定端点没有帮助。我收到的错误如“无法从{{3}获取元数据”如果这是您有权访问的Windows(R)Communication Foundation服务,请检查您是否已在指定地址启用了元数据发布。“
更新
Web.config片段:
<system.serviceModel>
<services>
<service name="AnalyticalServer.WebService">
<endpoint address="/AnalyticalServer/ws"
binding="basicHttpBinding"
contract="AnalyticalServer.AnalyticalServerWS" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:23/AnalyticalServer.WebService"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpBinding" scheme="http"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
答案 0 :(得分:1)
尝试将 web.config 更改为
<service name="AnalyticalServer.WebService">
<endpoint address="/AnalyticalServer/ws"
binding="basicHttpBinding"
contract="AnalyticalServer.AnalyticalServerWS" />
<host>
<baseAddresses>
<add baseAddress="http://195.50.152.240:23/monitoring.svc/" />
</baseAddresses>
</host>
</service>
之后,您的WCF服务将在http://195.50.152.240:23/monitoring.svc/上提供,您可以在http://195.50.152.240:23/monitoring.svc/AnalyticalServer/ws上访问 contract =“AnalyticalServer.AnalyticalServerWS”。
如果您的特殊服务器在此之后不会看到您的WCF服务,请尝试更改端点的绑定(我认为端点地址中的 / ws 可能意味着wsHttpBinding)
另请阅读this以了解什么是服务端点和主机基址。