Pregunta

I have a WCF service that uses netTcpBinding, transferMode="Streamed", and is installed via installutil via the Windows Process Activation Services method. The service builds and installs just fine. I have all the correct rights for NETWORK SERVICES on the containing folder to access the .exe file. My problem is I keep getting the error:

"The service [ServiceName] on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs."

What is odd is the host installer code is the same as a buffered service I have that runs just fine. In the streamed service, I accounted for passing streams and messages where needed. I am stuck. I can't seem to find out why this service will not stand up. I checked ports, and they are open (no conflict). Does anyone have advice on 'Streamed' netTcp services not starting?

Below is what the App.Config looks like:

<system.serviceModel>
    <!--### Service Endpoints: ###-->
    <!--Define Bindings-->
    <bindings>
      <netTcpBinding>
        <binding name="netTcpStreamedBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:20:00" sendTimeout="00:10:00"
            transferMode="Streamed" maxBufferPoolSize="104857600"
            maxReceivedMessageSize="1073741824" maxBufferSize="262144">

    <!-- Commented below out to match service that worked to see if this was error - It is not the problem (still no start)
        <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>-->

        </binding>
      </netTcpBinding>
    </bindings>

      <!--Streamer Service-->
    <services>
      <service name="MyServiceLib.FileStreamer">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpStreamedBinding" contract="MyServiceLib.IFileStreamer">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:.../MyStreamerService"/>
          </baseAddresses>
        </host>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="False" httpsGetEnabled="False"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>
¿Fue útil?

Solución

It appears, even using Visual Studio 2012 I ran into this bug (originally posted for VS 2010):

Bug 571961 (marked as closed) - "Unable to Copy File"

This bug throws the "Unable to copy file... because it is being used by another process" error. The workaround worked for me - clean the project. Close Visual Studio. Re-open VS. Build the project. Following this process allowed me to build my service.

Additionally, on repeated builds, part of the issue was the need to "stop" the service in the Services manager before builds. be sure not to forget this.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top