Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.ServiceModel.ServiceHost, cannot be used for communication because it is in the Faulted state

Tags:

wcf

msmq

Receiving this error when trying to work with the queue:

Unexpected error occured: The communication object, System.ServiceModel.ServiceHost, cannot be used for communication because it is in the Faulted state. at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)

How to overcome it?

Update: answer to my solution posted at the end

like image 804
GrimSmiler Avatar asked Aug 14 '13 11:08

GrimSmiler


3 Answers

This problem is due to access rights. Start Visual Studio with administrative rights and the problem will be resolved. To start Visual Studio with admin rights right click the Visual Studio icon and select "Run As Administrator".

like image 87
aashish saxena Avatar answered Jan 04 '23 11:01

aashish saxena


Update: In my case what helped was:

1) enabling trace logs: http://msdn.microsoft.com/en-us/library/ms732023.aspx

2) in the trace log it wrote this:

Binding validation failed because the binding's ExactlyOnce property is set to true while the destination queue is non-transactional. The service host cannot be opened. Resolve this conflict by setting the ExactlyOnce property to false or creating a transactional queue for this binding.

The answer says it all. Created a transactional queue - everything works :) hope it helps people :)

like image 27
GrimSmiler Avatar answered Jan 04 '23 11:01

GrimSmiler


close your solution, Now follow these steps: 1. Right click on the visual studio. 2. Click on Run as Administrator. 3. Now open your solution. 4. Try running it, your problem will be resolved.

like image 31
aditi mandloi Avatar answered Jan 04 '23 12:01

aditi mandloi