简体   繁体   中英

Hosting a WCF service to be consumed by multiple consumers, getting a FaultException

I have one computer acting as a WCF service host. a client machine will have multiple client processes running, each also hosting WCF services on separate ports (5601, 5602, etc.). The client processes will handshake the host. Once the handshake is received, the host will send back some data. The client processes are spawned one after another, as directed by a separate method on the host machine. However, I keep getting the following exception after starting more than one instance:

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Yet, when I add delay between the spawns, there appears to be no problem. What would be causing this, and how should I fix it?

spawns processes on the remote system which immediately try to handshake with the controller service on the main system.

        target.InitiateTestProcess(a);
        //System.Threading.Thread.Sleep(1000);
        target.InitiateTestProcess(b);

And for the handshake

    public void Handshake(Uri connectBack)
    {
        IWorkerContract client = ChannelFactory<IWorkerContract>.CreateChannel(
            new BasicHttpBinding(),
            new EndpointAddress(new Uri(connectBack, "Worker")));

        client.PassUUT(clients[connectBack]);
    }

Please comment if additional info is needed and I'll try to address your questions to the best of my abilities.

I solved the problem, I enabled IncludeExceptionDetailInFaults consumers so they would report back exception details. The workers were creating and reading files, often the same file (With testing, it was always the same file), and there was occasionally a collision when two+ processes would try to read the same file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM