WCF服务只侦听本地主机(127.0.0.1)

WCF服务只侦听本地主机(127.0.0.1)

问题描述:

我有WCF服务,它作为Windows服务。服务工作正常,与100多个客户进行了测试。但是一台机器只能在本地主机上运行。服务托管在Windows Server 2012 R2上。添加'netstat'的图像。在类似的工作服务器上,服务正在侦听'0.0.0.0:88'。WCF服务只侦听本地主机(127.0.0.1)

尝试了各种端点的0.0.0.0:88/MyService.svc', '198.x.x.x:88/MyService.svc', '主机名:88/MyService.svc' 一切工作只localy。

服务配置:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <appSettings> 
    <add key="connectionString" value="xxxxx"/> 
    </appSettings> 
    <connectionStrings>  
    </connectionStrings> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="BehaviourService"> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="FvsBasicHttp" receiveTimeout="00:20:00" sendTimeout="00:20:00" openTimeout="00:20:00" closeTimeout="00:20:00" 
       maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" maxDepth="32" maxBytesPerRead="2147483647"/> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service name="FvsWebServiceWcf.FvsService" behaviorConfiguration="BehaviourService" > 
     <endpoint name="FvsService" address ="" binding="basicHttpBinding" bindingConfiguration="FvsBasicHttp" contract="FvsWebServiceWcf.IFvsService"></endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://195.x.x.x:88/MyService.asmx"/> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
</configuration> 
+0

然后显示您的wcf服务的配置 – BugFinder

可能的猜测:有人通过设置HTTP.SYS只localhost接口上听乱七八糟的机器了。你可以通过运行以下命令检查:

netsh.exe http show iplisten

如果确实如预期回报127.0.0.1,你可能需要删除与(netsh.exe http delete iplisten ipaddress=127.0.0.1)的条目。不确定是否需要再次添加0.0.0.0才能使其再次运行。

+1

tomasr非常感谢,保存了我的一天。命令:“netsh http add iplisten ipaddress = 0.0.0.0”和“netsh http delete iplisten ipaddress = 127.0.0.1” – Ramunas