Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Protocol Exception

I am experiencing real problems with WCF. For no apparent reason I have started getting the following errors when debugging any WCF service in my solution:

ProtocolException Occurred Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8. The client and service bindings may be mismatched.

Clicking continue on the exception window details leads on to a different exception:

Could not load file or assembly 'System.Xml.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

The Disassembly window in Visual Studio also appears when these exceptions occur.

After clicking continue until the exceptions stop the WCF Test Client starts but invoking any of my service methods gives me this exception:

PlatformNotSupportedException The specified cryptographic algorithm is not supported on this platform.

I tried to add my existing service to a new blank solution and the errors ceased. However, after running my service a couple of times, the errors have started again.

I actually have two WCF services in my solution (one a WCF Workflow Service and one a WCF service that exposes data access methods (Entity Framework), a web application and a few other supporting class libraries. Attempting to run the web application or any service in isolation now gives me the same Protocol Exception.

Any help will be greatly appreciated. I am using Visual Studio 2010, targeting 4.0 of the .Net Framework.

Thanks

like image 487
Joanna Avatar asked May 20 '10 08:05

Joanna


1 Answers

I also experienced the

Could not load file or assembly 'System.Xml.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

error message. My assembly references were correct, so very odd indeed. To get rid of the error, I found the following to work (hoping for an explanation here some time in the future). :)

Visual Studio top menu : Debug > Exceptions > Reset all

Ref this post by Peter G.

Hope this helps,

like image 86
John Korsnes Avatar answered Sep 30 '22 16:09

John Korsnes