【问题标题】:IIS 7 ERR_CONNECTION_TIMED_OUT only with public IPIIS 7 ERR_CONNECTION_TIMED_OUT 仅使用公共 IP
【发布时间】:2015-06-09 11:22:49
【问题描述】:

我正在 IIS 7 上使用 WCF。

以前,我已经完成了一个 WCF 库并将其设置为在 IIS 7 上运行。它运行良好,如果我将它与我们的公共 IP 一起使用。

然后,我做了一个 WCF 应用程序,并将它设置为在相同的 IIS 7 上工作。地址相同,不同之处在于端口。当我使用内部 IP 调用此 WCF 时,它可以工作,但如果我使用外部 IP,则会出现超时错误。

你可以自己试试,这是公开地址:

http://77.108.40.77:8096/

(如果你把 8095 作为端口,它可以工作)。

为什么我会得到这个? (ERR_CONNECTION_TIMED_OUT)

这是我的 web.config:

<?xml version="1.0" encoding="utf-8"?>
    <configuration>

      <configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.``0, Culture=neutral, ``PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
     <httpRuntime targetFramework="4.5" />
   </system.web>
  <system.serviceModel>
    <services>
  <service name="MultipayOnline.Service1" >
    <!--bindingConfiguration="SecurityByTransport"-->
    <!--<endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecurityByTransport" name="base" contract="CardServiceLib.ICardService">-->

      <endpoint address="" name="base"
              behaviorConfiguration="restBehavior"
              binding="webHttpBinding"
              contract="MultipayOnline.IMultiPOService" >
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
  </service>
</services>
<bindings>
  <webHttpBinding>
    <binding name="SecurityByTransport" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" >
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Basic"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>


<extensions>
  <behaviorExtensions>
    <add name="CorsSupport" type="WebHttpCors.CorsSupportBehaviorElement, WebHttpCors, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  </behaviorExtensions>
</extensions>


<behaviors>
  <endpointBehaviors>
    <behavior name="restBehavior">
      <!--<enableWebScript/>-->
      <webHttp helpEnabled="true"/>
      <CorsSupport />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="123456" />
    </behavior>
    <!--<behavior name="customBehavior">
      <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
      <serviceDebug includeExceptionDetailInFaults="True"/>
      <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="123456" />
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MultipayOnline.CustomPass, MultipayOnline"/>
      </serviceCredentials>
    </behavior>-->
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />


<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
  </system.serviceModel>
  <system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
    Per sfogliare la directory radice dell'applicazione Web durante il debug, impostare il valore riportato sotto su true.
    Impostarlo su false prima della distribuzione per evitare di diffondere informazioni sulla cartella dell'applicazione Web.
  -->
<directoryBrowse enabled="true" />
<!--<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
  </customHeaders>
</httpProtocol>-->
  </system.webServer>


  <connectionStrings><add name="isMultiPayOnLineEntities" connectionString="..." providerName="System.Data.EntityClient" />    </connectionStrings>

你能帮帮我吗?我可以发一些东西给你,让问题更清楚吗?

【问题讨论】:

  • 该端口是否在您的防火墙上打开/转发到您路由器上的本地计算机?
  • 你的意思是在iis服务器的防火墙里吗?
  • 好吧,你拥有的任何防火墙都在互联网和那台机器之间,真的。另外:可能是您的路由器上不允许本地环回,因此您将无法使用公共 IP 从网络内部引用机器。
  • 好的,我会检查这个并给你一个更新......同时,如果你有其他提示.. :)
  • 其他提示,或许学习基本的网络故障排除? :)

标签: c# wcf iis iis-7 web-config


【解决方案1】:

我认为您的端口已关闭。检查您的 IP 和端口 http://ping.eu/port-chk/ 如果其状态已关闭,则会显示此消息。请打开这个端口来解决这个问题..

【讨论】:

    猜你喜欢
    • 2012-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-22
    • 2017-01-22
    • 2023-01-04
    • 2021-05-28
    • 1970-01-01
    相关资源
    最近更新 更多