Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you configure WCF to support FaultContracts where both the host and client are in the same process using a net.pipe?
    text
    copied!<p>I'm trying to create an in-process unit test for my service to client interactions using net.pipe binding. Like a good WCF service it uses FaultContractAttribute on service operations to expose possible faults <em>(wrapped exceptions)</em> to metadata. I would like to have the client and service endpoints configured thru XML <em>(App.config).</em> However, whenever a fault is thrown, it's just a CommunicationException "pipe has closed", and not the typed Fault I was expecting.</p> <pre><code>System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). </code></pre> <p>I tried Adding IMetadataExchange endpoint for net.pipe, but that didn't work. I also tried . Which being on Vista required me to netsh the ACL for the http endpoint. That too did not work.</p> <p>The custom exception class:</p> <pre><code>public class ValidationException : ApplicationException { } </code></pre> <p>This is the latest attempt at a config, but it pumps out <em>"The contract name 'IMetadataExchange' could not be found in the list of contracts implemented by the service"</em></p> <p>Any Links to examples or recommendations for how to get this done would be appreciated.</p> <p></p> <p></p> <pre><code>&lt;system.serviceModel&gt; &lt;client&gt; &lt;endpoint name="Client" contract="IService" address="net.pipe://localhost/ServiceTest/" binding="netNamedPipeBinding" bindingConfiguration="netPipeBindingConfig" /&gt; &lt;/client&gt; &lt;services&gt; &lt;service name="Service" behaviorConfiguration="ServiceFaults"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="net.pipe://localhost/ServiceTest/"/&gt; &lt;add baseAddress="http://localhost/ServiceTest/"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="" binding="netNamedPipeBinding" bindingConfiguration="netPipeBindingConfig" name="ServicePipe" contract="IService" /&gt; &lt;endpoint address="MEX" binding="mexNamedPipeBinding" bindingConfiguration="mexNetPipeBindingConfig" name="MexUserServicePipe" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;netNamedPipeBinding&gt; &lt;binding name="netPipeBindingConfig" closeTimeout="00:30:00" sendTimeout="00:30:00" /&gt; &lt;/netNamedPipeBinding&gt; &lt;mexNamedPipeBinding&gt; &lt;binding name="mexNetPipeBindingConfig"&gt;&lt;/binding&gt; &lt;/mexNamedPipeBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="ServiceFaults"&gt; &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt; &lt;/behavior&gt; &lt;behavior name="MEX"&gt; &lt;serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost/ServiceTest/MEX"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; </code></pre> <p> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload