1

I'm having trouble to consume my WCF service that is hosted on an web IIS (IIS 8.0). I can access the .svc page and add reference to the service on my WPF application, but when I call/invoke some of the wcf service methods, i got an exception:

There was no endpoint listening at mywebsite.com.br/blusync/BluService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.System.Net.WebException: The remote server returned an error: (404) Not Found.\r\n at System.Net.HttpWebRequest.GetResponse()\r\n at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannel‌​Request.WaitForReply(TimeSpan timeout)

Since the address is correct, I assume the error is being caused by some security/authentication issue.

Here is an example of how i'm using the method:

MyServiceClient client = new ServiceClient();
client.Open();
client.GetDate();
client.Close();

Here`s my app.config on the client app:

    <?xml version="1.0" encoding="utf-8" ?><configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IBluService" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://www.mywebsite.com.br/blusync/BluService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBluService"
                contract="BluService.IBluService" name="BasicHttpBinding_IBluService" />
        </client>
    </system.serviceModel>
</configuration>

Here`s my web.config on the server side:

    ?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <customErrors mode="Off"/>
    <!--<trust level="Full" /> -->
    <compilation debug="true" targetFramework="4.0"/>
    <pages controlRenderingCompatibilityVersion="4.0"/>
  </system.web>
  <system.serviceModel>
    <client>
      <endpoint
        name="endpoint1"
        address="BluService"
        binding="basicHttpBinding"
        bindingConfiguration="basicHttpBinding_IBluService"
        behaviorConfiguration="IBluService_Behavior"
        contract="IBluService" >

        <metadata>
          <wsdlImporters>
            <extension
              type="Microsoft.ServiceModel.Samples.WsdlDocumentationImporter, WsdlDocumentation"/>
          </wsdlImporters>
        </metadata>

        <!--<identity>
          <userPrincipalName value="inbluser@inblu" />
        </identity>-->
      </endpoint>
    </client>

    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding_IBluService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
      <binding name="IstMembershipBinding">
       <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName" />     
       </security>
      </binding>
     </wsHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
          <behavior name=" IBluService_Behavior ">
              <clientVia />
          </behavior>
      </endpointBehaviors>    
      <serviceBehaviors>
        <behavior name="MetadataBehavior">
          <serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True" />
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="BluSync.BluService" behaviorConfiguration="MetadataBehavior">
        <endpoint address="" binding="basicHttpBinding" contract="BluSync.IBluService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://www.mywebsite.com.br/sync/BluService.svc" />
          </baseAddresses>
          <timeouts closeTimeout="00:01:10" openTimeout="00:09:00" />
        </host>
      </service>
    </services>
    <protocolMapping>
      <add scheme="https" binding="basicHttpsBinding"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
    <diagnostics>
        <messageLogging maxMessagesToLog="30000" 
                logEntireMessage="true" 
                logMessagesAtServiceLevel="true" 
                logMalformedMessages="true" 
                logMessagesAtTransportLevel="true">
        </messageLogging>
    </diagnostics>
  </system.serviceModel>
  <system.diagnostics>
    <sources>
        <source name="System.ServiceModel" 
                switchValue="Verbose, ActivityTracing" 
                propagateActivity="true" >
                <listeners>
                        <add name="xml" />
                </listeners>
        </source>
        <source name="System.ServiceModel.MessageLogging" 
                switchValue="Verbose">
                <listeners>
                        <add name="xml" />
                </listeners>
        </source>
    </sources>
    <sharedListeners>
            <add name="xml" 
                type="System.Diagnostics.XmlWriterTraceListener" 
                initializeData="e2eTraceTest.e2e" />
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
  <!--<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>-->
</configuration>

My WCF is hosted on an web host with IIS 8.0 and I set the framework to 4.0, and i'm publishing the project through ftp.

I tried a lot of different bindings, but I'm a newbie in this technology.. Please, help me guys, i'm stuck in here!

Vinay Pandey
  • 8,589
  • 9
  • 36
  • 54
Marcelo
  • 11
  • 2
  • I am not sure if this is related but try reading this article : https://3water.wordpress.com/2012/09/05/host-wcf-in-iis8-windows-server-2012/ – vincent Nov 24 '15 at 12:56
  • Next time please do not post code/error messages in the comments section. Use the **edit** button in your question instead. – jsanalytics Nov 24 '15 at 13:59
  • It might be a binding mismatch, though the only difference I noticed at a quick glance is the message security algorithm suite is set to Default in your service definition. Try taking the `` section from your service config file and copying it to your client's config file to see if that resolves the issue. – Tim Nov 24 '15 at 17:07
  • After changing the client binding, I still got the same problem Tim. – Marcelo Nov 25 '15 at 11:41

0 Answers0