简体   繁体   中英

What Is Wrong With My ASP.NET WCF Configuration?

I have a WCF service nested in an ASP.NET 4.5 web application and everything was running without issue until I attempted to specify a port. I have to run on a separate port as per my client's requirements but I cannot figure out what I am doing wrong.

For now I am running everything local and I did punch holes in my firewall so I know that is not the issue. The error I get - System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:59031 - tells me that I have no listener attached so, again, it must be my config. Right?

Here is a call:

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

And here is my config:

<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>

Again everything worked until I tried adding the port number - can somebody please help me out?

Thanks!

Are you using the correct port number? Also, make sure that there is no firewall restrictions and the port is open.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM