简体   繁体   中英

WCF Configuration Error: There was no endpoint listening at

I am trying to use a WCF service (I didn't write) from a WebAPI and am getting the dreaded 'There was no endpoint listening at...' error. The interesting thing is that the service has a test ASPX page that uses it without error. So I copied the client portion of the config and added that to my API.

Client:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IAuthenticationService" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647">
                <security mode="Transport" />
            </binding>
        </basicHttpBinding>
        <customBinding>
            <binding name="CustomBinding_ILockboxServiceV1">
                <security authenticationMode="UserNameOverTransport" includeTimestamp="true">
                    <secureConversationBootstrap />
                </security>
                <textMessageEncoding messageVersion="Default" writeEncoding="utf-8" />
                <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="https://devsandbox2.imagebankingsystem.com/LockboxRemote.Web/ws/LockboxServiceV1.svc"
            binding="customBinding" bindingConfiguration="CustomBinding_ILockboxServiceV1"
            contract="PaymentGateway.ILockboxServiceV1" name="CustomBinding_ILockboxServiceV1" />
        <endpoint address="https://devsandbox2.imagebankingsystem.com/LockboxRemote.Web/ws/AuthenticationService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAuthenticationService"
            contract="PaymentGatewayAuthentication.IAuthenticationService" name="BasicHttpBinding_IAuthenticationService" />
    </client>
</system.serviceModel>

Server:

<services>
  <service name="LockboxRemote.Web.ws.LockboxServiceV1" behaviorConfiguration="ServiceBehavior">

    <endpoint behaviorConfiguration="MexFlatWSDLBehavior" address="" binding="customBinding" contract="LockboxRemote.Web.ws.ILockboxServiceV1" bindingConfiguration="myConfig" bindingNamespace="https://devsandbox2.imagebankingsystem.com/LockboxRemoteGateway/ws/LockboxServiceV1"/>
  </service>


</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="MexFlatWSDLBehavior">
      <FlatWSDL />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceAuthorization principalPermissionMode="Custom">
        <authorizationPolicies>
          <add policyType="LockboxRemote.Web.AuthorizationPolicy, LockboxRemote.Web" />
        </authorizationPolicies>
      </serviceAuthorization>
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom"
          customUserNamePasswordValidatorType="LockboxRemote.Web.CustomValidator,LockboxRemote.Web" />
      </serviceCredentials>
      <serviceSecurityAudit auditLogLocation="Application" serviceAuthorizationAuditLevel="Failure" messageAuthenticationAuditLevel="Failure" suppressAuditFailure="true" />
    </behavior>
    <behavior>
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceAuthorization principalPermissionMode="None"/>
      <serviceSecurityAudit auditLogLocation="Application" serviceAuthorizationAuditLevel="Failure" messageAuthenticationAuditLevel="Failure" suppressAuditFailure="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

May or may not be important but my WebAPI is on the same server but in a different virtual directory.

Thanks in advance.

Turns out nothing was wrong with it. The error was caused by the firewall which was preventing the server from talking to itself through the external address. Added a hostsfile entry to get around that.

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