aviv
aviv

Reputation: 1823

soap client working from console app, timeout when called from within wcf service

here is the deal: I have a class library that makes calls to a web service via a soap client. When called from within a console application it works fine. When called from within a WCF service which is invoked by an http call I get an "EndpointNotFoundException - There was no endpoint listening at http://blablabla.asmx that could accept the message. This is often caused by an incorrect address or SOAP action..."

both app.config and web.config contain the exact same configuration for the client endpoint

so, whats going on? by the way, the WCF is running locally from Visual Studio. The soap web service I am trying to call is located on the internet.

this is how the service model configuration looks like. Its using basic authentication and the user and password are being set in code in the class library:

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="VocalServerSoap">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Basic" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://pseudourl.asmx"
    binding="basicHttpBinding" bindingConfiguration="VocalServerSoap"
    contract="VocalWebService.VocalServerSoap" name="VocalServerSoap" />
</client>

architecture

Upvotes: 2

Views: 1774

Answers (2)

aviv
aviv

Reputation: 1823

update: this turned out not to be the problem. see my next post for clarifications

Nailed it down thanks to help from this post The problem was permissions - the application pool identity that ran the code from the WCF scope did not have permissions for internet access. Once i ran the web (change identity in IIS) site under a user that has permissions it worked.

Upvotes: 2

aviv
aviv

Reputation: 1823

ohhhh.... the frustration! After I thought I had it nailed down as a permissions problem (as per my prior post) it reverted to the same behavior of timing out.

Eventually its all because of the proxy.... it turns out that (from msdn):

Applications running as an NT Service or as part of ASP.NET use the Internet Explorer proxy server settings (if available) of the invoking user. These settings may not be available for all service applications.

so my requests to the soap service invoked from within the WCF service did not have a proxy configured at all... hence the no end point exception.

To overcome this I had to declare manually the proxy in the soap client binding:

<binding name="VocalServerSoap" proxyAddress="http://<your proxy address>:<proxy port>"
      useDefaultWebProxy="false">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Basic" />
      </security>
    </binding>

So why did I think it was permissions? How come it was working from time to time? Well, Fiddler had caused me a real confusion.... when activating fiddler everything worked since all outgoing requests where being routed to the proxy correctly because fiddler was using the system proxy.

I can not believe this wasted almost a day of my life :(

Upvotes: 3

Related Questions