Browser connects to WCF service but not my WCF client. What can be the reason?

Posted by Slauma on Stack Overflow See other posts from Stack Overflow or by Slauma
Published on 2010-06-14T23:32:35Z Indexed on 2010/06/14 23:52 UTC
Read the original article Hit count: 600

Filed under:
|

On a production server (Windows Server 2003 SP2) I can connect to a remote WCF service with Internet Explorer 8: When I browse to the URL http://www.domain.com/Service.svc (where my service listens) I get the expected info page of the service displayed. Connection settings in Internet Explorer only specify "auto detect", proxy settings are disabled.

If I start a console application (built with WCF in .NET 4.0) on the same server which also tries to connect to the same WCF service it fails telling me that no endpoint was available listening on http://www.domain.com/Service.svc.

Configuration of the WCF client:

<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IMyService" 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://www.domain.com/Service.scv"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
          contract="Service.IMyService" name="WSHttpBinding_IMyService" />
    </client>
  </system.serviceModel>
<configuration>

With these settings I can communicate successfully with the remote service from my development machine.

Looking around for other options I found that I can specify to use the Internet Explorer proxy settings with:

<system.net>
  <defaultProxy>
    <proxy usesystemdefault="true" />
  </defaultProxy>
</system.net>

It didn't work and I am not sure if I understood this setting really correctly. (My hope was that the WCF client will adopt the "autodetect" setting of Internet Explorer and then connect the same way to the service like the installed IE.)

I also had toggled the useDefaultWebProxy setting in the binding configuration between true and false with no success.

Now I am asking for help what I can do? Which settings might be wrong or missing? What could I test and how can I get more detailed error messages to better identify the problem?

Thank you in advance!

© Stack Overflow or respective owner

Related posts about wcf

Related posts about wcf-client