views:

374

answers:

1

I am trying to generate a client proxy from a WCF service library. I am using VS2005, .NET 3.0 on a Windows XP Pro workstation. The WCF service is hosted in a windows service. When I run the windows service as a console application, there are no problems. I can run svcutil.exe against that address and it generates the proxy. However, when I compile that service in release mode, and install it on the workstation using InstallUtil, I get an error "Error: Cannot obtain Metadata from net.tcp://localhost:9090/Service2 ". These are the settings I am using the app.config for the service

<behaviors>
  <endpointBehaviors>
    <behavior name="Test2">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="serviceBehaviour">
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceMetadata />
      <!--<serviceMetadata httpGetEnabled="true" />-->
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
  </serviceBehaviors>
</behaviors>


<bindings>
  <customBinding>
    <binding name="TestBinding2" inactivityTimeout = "00:30:00"  openTimeout="00:30:00"
         receiveTimeout="00:30:00"
         sendTimeout="00:30:00">
      <binaryMessageEncoding />
      <tcpTransport transferMode="StreamedResponse" />

    </binding>
  </customBinding>
</bindings>

A: 

A couple of shots in the dark...

Is your Windows service running? Beyond that, is your WCF service running within the Windows service? My project is also hosting a WCF service in a Windows service (you can see the general step-by-step here). Even though I have the Windows service marked to start automatically, I still have to manually start it the first time. Perhaps there is a command-line option of InstallUtil.exe that I'm not aware of that will do this for me. But the point is, if your Windows service or your WCF service inside is not running, you obviously can't see the MEX endpoint.

The other thing I noticed. Your error says that the metadata cannot be obtained from net.tcp://localhost:9090/Service2, but the base address you posted in your comment shows net.tcp://localhost:9090/Service_2. Perhaps this is just a type-o, but it wouldn't hurt to double-check that everything is spelled correctly, especially if the add.config is hand-generated.

Matt Davis