IIS 7 使用公共IP时出现ERR_CONNECTION_TIMED_OUT错误

3

我正在使用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>

你能帮助我吗?我可以给你发布一些内容,以便更清楚地解释问题吗?


你的防火墙是否开放了该端口/是否将该端口转发到路由器上的本地计算机? - TZHX
你的意思是在IIS服务器的防火墙上吗? - Piero Alberto
其他提示,也许学习基本的网络故障排除? :) - TZHX
抱歉,我通常不这样做...所以...我有一些疑问!我希望fw是答案...谢谢你的耐心。 - Piero Alberto
是的,就是那样.. 对不起问了这么个愚蠢的问题,如果你能写下答案,我会将其设置为解决方案! :) - Piero Alberto
显示剩余3条评论
1个回答

2

我认为您的端口被关闭了。请在http://ping.eu/port-chk/上检查您的IP和端口,如果状态是关闭的,则会显示此消息。请打开此端口以解决此问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接