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
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,
Related
I'm having several issues with my WCF client in that the client Reference.cs is empty and the only error I get on the build is the useless generic message:
Severity Code Description Project File Line Suppression State
Warning Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/']/wsdl:portType[#name='IBrokerWcf'] MyWeb.Setup C:\Users\me\Projects\MyWeb 3.x\MyWeb v3.x\MyWeb.Setup\Service References\BrokerWcfSvc\Reference.svcmap 1
When I load the Service in the WCF Test Client, all of the advertised async methods error out (see image) with "This Operation is not supported in the WCF Test Client because it uses type System.Threading.Tasks.Task'1"
All of this previously worked fine. Not sure what changed to send it all sideways.
System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: The located assembly's manifest definition does not match the
assembly reference.
As the error says, the manifest definition of the locating assembly does not match the assembly reference.
You need to check the components. Did you click "Reuse types in referenced assemblies" when adding a service reference.
This Operation is not supported in the WCF Test Client because it uses
type System.Threading.Tasks.Task'1"
The "error" you are seeing is just a limitation of the test tool that comes with visual studio, both functions call the same server side function so there is no compelling force to make Microsoft add support. There is no actual error. If you really want to test the async version you will need to write your own test client that calls the function.
Error : not supported in WCF Test client because it uses type System.Threading.Tasks
Scenario: I have a WCF endpoint (endpoint Manufacturing) that connects another WCF endpoint (endpoint DataAPIClient) as ConnectedService. The constructor of an entity in A instantiate the "client" (see below). On top of all these, I have a xUnit test project testing A.
// Manufacturing constructor
public Manufacturing() {
client = new DataAPIClient();
}
// Instantiating in the xUnit project
Manufacturing endpoint = new Manufacturing();
Problem: Something changed (and I couldn't figure out what) that when the test project tries to instantiate Manufacturing. I got this error:
Message: System.IO.FileNotFoundException : Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
I have verified the System.ServiceModel.dll in both endpoints. DataAPIClient has 4.0.30319 and manufacturing has 4.0.0.0.
P.S. I did change the name of the Manufacturing project...not sure if that caused that, but I thought it might be worth of mentioning.
Any help is greatly appreciated...I've been googling and found nothing.
per howcheng's suggestion, I noticed that since I was using xUnit Test Project (.NET Core), I couldn't (or maybe I just didn't know how) add any reference to System.ServiceModel.dll. So I created a Unit Test Project (.NET Framework) and added the xUnit Nugets and System.ServiceModel.dll assembly. The error went away.
I'm trying to connect to an IBM message queue using .net and MQ client v8.0.0.5 but I keep receiving the following error:
Fatal error. Failed to initialize XMSFactoryFactory
Could not load file or assembly 'IBM.XMS.Client.Impl, Version=8.0.0.5,
Culture=neutral, PublicKeyToken=d2666ab12fca862b' or one of its
dependencies.
The system cannot find the file
specified.":"IBM.XMS.Client.Impl, Version=8.0.0.5, Culture=neutral,
PublicKeyToken=d2666ab12fca862b
Here's what I've done so far:
Installed MQ Client v8.0.0.5 (x64) on my machine.
Referenced the following assemblies:
amqmdnet.dll
amqmdnsp.dll
amqmdxcs.dll
IBM.XMS.dll
IBM.XMS.Admin.dll
IBM.XMS.Client.Impl.dll
IBM.XMS.NLS.dll
IBM.XMS.Provider.dll
IBM.XMS.Util.dll
Now I also have version v7.5.0.4 installed on my machine and that is having no issues connecting to the queue.
One more thing I noticed is there are no assemblies for v8.0.0.5 in the GAC but the assemblies for v7.5.0.4 are present. Can that be the reason?
Unfortunately, I cannot remove v7.5.0.4 until have both the versions working normally.
Yes, MQ v8.0.0.5 XMS .NET assemblies not being in the GAC is most likely the cause.
You can look at the alternative of using redirection, update app.config file to use the correct version of assemblies your application requires. Look into your MQ installation directory for a file called NonPrimaryRedirect.config. This file contains sample configuration required for application to look for a specific version of MQ/XMS .NET assembly. Copy the contents of this file to your application's app.config file and try. You must ensure all href attributes point to correct path.
We have a Service Fabric application with several actors and services. The actors & services successfully deploy and run on most of the development machines. On a few of the development machines, however, one of the services shows in an error status for no apparent reason.
In Service Fabric Explorer, the error icon shows on the Cluster all the way down to the partition. However, the node did not show that it was in an error state. Several minutes of waiting later, the node did show a warning icon and the following error message:
Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus',
HealthState='Warning', ConsiderWarningAsError=false. Replica had
multiple failures during open. Error =System.TypeLoadException
(-2146233054) Could not load type
'Microsoft.ServiceFabric.Data.ReliableStateManagerImpl' from assembly
'Microsoft.ServiceFabric.Data.Impl, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' at
Microsoft.ServiceFabric.Data.ReliableStateManager.get_Impl() at
Microsoft.ServiceFabric.Data.ReliableStateManager.Microsoft.ServiceFabric.Data.IStateProviderReplica.Initialize(StatefulServiceInitializationParameters
initializationParameters) at
Microsoft.ServiceFabric.Services.Runtime.StatefulServiceBase.System.Fabric.IStatefulServiceReplica.Initialize(StatefulServiceInitializationParameters
initializationParameters) at
System.Fabric.ServiceFactoryBroker.CreateHelper[TFactory,TReturnValue](IntPtr
nativeServiceType, IntPtr nativeServiceName, UInt32
initializationDataLength, IntPtr nativeInitializationData, Guid
partitionId, Func3 creationFunc, Action2 initializationFunc,
ServiceInitializationParameters initializationParameters)
I set breakpoints and found that every expected line of program.cs executes and it eventually gets to the Thread.Sleep(Timeout.Infinite). But not a single line of the failing service's code gets hit.
The service at issue is Stateful and shares an assembly with a Stateless Actor. I don't tend to put two actors/services in one dll but a colleague did and it works for most of the team. Don't know if this is a potential issue.
Everyone on the team was running SDK 1.5 when this occurred on two dev machines. I upgraded to SDK 2.0 (but didn't change the assembly references in Nuget to use the 2.0 assemblies). Same problem.
I did a search for the assembly 'Microsoft.ServiceFabric.Data.Impl' and found it under [Program Files]\Microsoft Service Fabric\bin\Fabric\Fabric.Code. It is version 5.0.135.9590.
My colleague, who has it working, has that same file as version 4.5.175.9590.
Any help or advice is greatly appreciated.
Unfortunately I don't know the specifics, but I believe that once you've fully upgraded (latest SDK + latest nuget packages) the issue will go away.
I have an ASP.NET 3.5 web application which works perfectly fine on my local machine and when I deploy it on my Windows 2008 server. I am getting the following javascript error:
Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 4723
Char: 21
Code: 0
URI: http://localhost/ScriptResource.axd?d=e1Gld4LGHLsC4rWqevEI8zAMJKoVcCEVHBjdJIxcQLO9of6t7nNopbI1YyxJTv1QbaxN_lTSoz5Ly-VjBRHp08Mf3xxg5V9i5Z0AiXIkZRY1&t=6af1de90
I have a utility which can decrypt the URI and tell exactly what file is missing and it tunrns out that the file is ZSystem.Web.Extensions,3.5.0.0,,31bf3856ad364e35|MicrosoftAjax.debug.js|. Why am I not able to load this js file? Any help?
Possible options:
You've not installed .NET Framework SP1 on your server, so it can't find the 3.5 assemblies to generate the MsAjax file.
You've deployed your web.config file with <compilation debug="true"> while IIS has been configured to compile it in release mode.
I have run into a similar problem before when the development and production machines are set for two different time zones. When ASP.NET AJAX tries to load a script resource from an assembly, the last modified date/time of the assembly is validated. If the local time of the production server is "earlier" than the last modified date/time of the assembly, then an ArgumentOutOfRange exception is generated by ASP.NET AJAX when processing the request.
Really difficult to debug since the problem eventually resolves itself.
I suppose this might be possible with a System assembly if Copy-Local is set to true.
I was using some third party web services and the problem was with the following xml tag in the web.config:
<extendedProtectionPolicy policyEnforcement="Never" />
Once I removed this tag the error went away