【问题标题】:What Is Wrong With My ASP.NET WCF Configuration?我的 ASP.NET WCF 配置有什么问题?
【发布时间】:2015-02-17 18:58:33
【问题描述】:

我有一个嵌套在 ASP.NET 4.5 Web 应用程序中的 WCF 服务,并且在我尝试指定端口之前,一切都正常运行。我必须根据客户的要求在单独的端口上运行,但我无法弄清楚我做错了什么。

现在我在本地运行所有东西,我确实在我的防火墙上打了几个洞,所以我知道这不是问题所在。我得到的错误 - System.Net.Sockets.SocketException: No connection could be made because the target machine positively denied it 127.0.0.1:59031 - 告诉我我没有附加侦听器,所以它必须是我的配置。对吧?

这是一个电话:

http://localhost:59031/seoland/seo.svc/Login?User=test&Pass=pass

这是我的配置:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
    <services>
      <service name="seoland.extranet.seo">
        <endpoint address="" behaviorConfiguration="json" binding="webHttpBinding" name="MainHttpPoint" contract="seoland.extranet.seo">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" name="MexEP" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:59031/seoland/seo.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding openTimeout="00:10:00" sendTimeout="00:10:00" useDefaultWebProxy="false">
          <readerQuotas maxDepth="32" maxStringContentLength="2048000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="json">
          <webHttp helpEnabled="false" automaticFormatSelectionEnabled="false" defaultBodyStyle="Bare"/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding" httpGetBindingConfiguration=""/>
          <serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="false" includeExceptionDetailInFaults="true"/>
          <useRequestHeadersForMetadataAddress>
            <defaultPorts>
              <add scheme="http" port="59031"/>
            </defaultPorts>
          </useRequestHeadersForMetadataAddress>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

在我尝试添加端口号之前一切正常 - 有人可以帮我吗?

谢谢!

【问题讨论】:

  • 您是否在 IIS 的默认网站或您托管应用程序的网站上配置了端口绑定?

标签: c# asp.net .net wcf


【解决方案1】:

您是否使用了正确的端口号?另外,请确保没有防火墙限制并且端口是开放的。

【讨论】:

  • 感谢您这么快回来。我确实验证了端口是否正确,它已在防火墙中打开,并且已在 IIS 中为 HTTP 协议注册。
  • 请检查您的绑定设置。尝试遵循此示例。 stackoverflow.com/questions/8514766/…
猜你喜欢
  • 1970-01-01
  • 2012-05-07
  • 2017-03-08
  • 2014-01-13
  • 2014-04-11
  • 2011-09-11
  • 2013-07-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多