0
Answered

Runtime error when trying the run a Powershell script that loads the SQL snapins from Event Broker

Carol Wapshere 12 years ago updated by anonymous 9 years ago 6

I have a script which works correctly when I run it manually. When run through Event Broker I get this:

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information

I found APRA-82 with the same problem but can't see what the resolution was after reading through all the comments.

The line that is causing the error is the one where I try and run a SQL query:

Invoke-SQLCmd ($sqlquery -f $timestamp,$MAName,$xmlstring) -SuppressProviderContextWarning

Hi Carol,

From my reading of APRA-82 it appears the addition of useLegacyV2RuntimeActivationPolicy="true" in the startup element was the fix. Unfortunately it's a little hard to read and no troubleshooting article came of it.

It appears to be similar to an error that I came up against for Microsoft Dynamics AX (IDBMDAX40:FileLoadException thrown when performing any operation).

If the fix works for you please let me know so that I can have an article created.

Thanks.

Still getting the same error. Just to check if I did the right thing: I updated the file Unify.Service.Event.exe.config in the folder C:\Program Files\UNIFY Solutions\Event Broker\Services. The startup section now looks like this:

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" useLegacyV2RuntimeActivationPolicy="true"/>
  </startup>

I then restarted the Event Broker service.

Almost:

<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>

Much better thankyou! Working properly now.

Fantastic, thanks.

I have created EB-590 to capture this as a troubleshooting article.

Richard Green - had to add the above

 useLegacyV2RuntimeActivationPolicy="true"

section to the Unify.Service.Event.exe.config file @ Origin today. Need to get this added into our install document too please.