简体   繁体   中英

WCF Client Can't connect to Host in same application instance

I have a WPF GUI that has two buttons. Button 1 creates a new WCF Host that listens for requests via Named Pipes. Button 2 uses a Client Proxy DLL to query the Host via Named Pipes.

Clicking button 2, the Client portion is unable to connect.

If however, I run a second instance of the client and click Button 2. It can connect?

The WCF host is running fine, once the server is started. I can also query it with the WCFTestClient ... so the problem only exists within the same instance.

The excpetion thrown is.


This request operation sent to net.pipe://localhost/SvcName did not receive a reply within the configured timeout (00:01:00). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.

Any thoughts would be greatly appreciated.

Thanks Warrick

Can you mark the class that implements your service with this:

[ServiceBehavior(UseSynchronizationContext = false)]

and try again.

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