Web Dev Matters and Me

Web Development Matters - HTML, XML, C#, .NET, AJAX/Javascript(jQuery), CSS, XML-XSLT

ME - LIFE,Philippines, Tokyo, ECE, PhilNITS/JITSE,情報処理, 日本語

things about Philippines, gaming, C# development and web development, how to make money in stock trading

Web Dev Matters and Me

A .NET Framework error occurred during execution of user-defined routine or aggregate

Msg 6522, Level 16, State 1, Procedure, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate :
System.TypeInitializationException: The type initializer  threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ServiceModel.WSReliableMessagingFebruary2005Version' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050) See Microsoft Knowledge Base article 949080 for more information.
System.IO.FileLoadException:
   at System.ServiceModel.WSReliableMessagingFebruary2005Version..ctor()
   at System.ServiceModel.WSReliableMessagingFebruary2005Version..cctor()
System.TypeInitializationException:
   at System.ServiceModel.WSReliableMessagingFebruary2005Version.get_Instance()
   at System.ServiceModel.Channels.ReliableSessionBindingElement..ctor(Boolean ordered)
   at System.ServiceModel.WSHttpBindingBase.Initialize()
   at System.ServiceModel.WSHttpBinding..ctor()
   at ADMS.CommonClrSQL.StoredProcedures..cctor()
System.TypeInitializationException:
.
The statement has been terminated.

====================================================


Hi! If you are experiencing the above error, I'm guessing that you are trying to invoke a Webservice from SQL.  Just lately, I was involved with a task that performs some upgrade in SQL Server database and making the database make a call to a WCF Service. Now, the problem is, whenever the procedure/trigger will make a request to the hosted service, it will throw an Error. This made us sleepless for days, trying to figure out the fix, but fortunately we are able to make things working.

We are experiencing the above error because the assemblies deployed in GAC(Global Assemby Cache) is different to assemblies loaded to the database. So, we tried to load the assembly from the GAC itself. There is a caution here. Be sure that the correct version of dll is loaded. Since there are 32 bit and 64 bit assemblies, you must refer FIRST to the GAC MSIL then if the assembly doesnt exist in there, refer to the appropriate X-Bit folder(32 or 64).

Doing this solved our problem. On our case, the error message we get now points to a machine configuration. An endpoint entry which is a malformed XML must be removed or commented out, then have the machine restart (since it is machine configuration).

0 comments:

FB Connect