简体   繁体   中英

WCF - There was no endpoint listening at http://xxxxx.xxxx/Service1.svc

When trying to call a function on the WCF Service i getting the error:

There was no endpoint listening at http://XXXXXXXXXXX.xxx/Service1.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

My WCF Service Web.config

<system.serviceModel>
    <services>
      <service name="Service1" behaviorConfiguration="MyServiceTypeBehaviors">
        <endpoint contract="IService1" binding="mexHttpBinding" address="mex" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

WCF Client app.config

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="MetadataExchangeHttpBinding_IService1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://XXXXXXXXXXX.xxx/Service1.svc"
        binding="wsHttpBinding" bindingConfiguration="MetadataExchangeHttpBinding_IService1"
        contract="API.IService1" name="MetadataExchangeHttpBinding_IService1" />
    </client>
  </system.serviceModel>

I have tried many many settings and configurations but dont getting this to work... do anyone find anything you think i missed?

Edit: I am hosting the service on a IIS and using a Winform client

You seem to have confused with service endpoint and mex endpoint. They are separate endpoints. Change your config on server to this:

 <endpoint contract="IService1" binding="wsHttpBinding" address="" />
 <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />

Then recreate proxy.

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