AX 2009 AIF error: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded

Hello,

When I browse the 'SalesOrderService.svc' file in IIS, I get the following error:

Server Error in '/MicrosoftDynamicsAXAif50' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'microsoft.dynamics.integrationframework.service' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Source Error:

Line 57:                 <add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 58:                 <add assembly="System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 59:                 <add assembly="*"/>
Line 60:         <add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 61:         <add assembly="System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>


Source File: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\web.config    Line: 59

Assembly Load Trace: The following information can be helpful to determine why the assembly 'microsoft.dynamics.integrationframework.service' could not be loaded.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = MyDomain\axbc
LOG: DisplayName = microsoft.dynamics.integrationframework.service
 (Partial)
LOG: Appbase = file:///C:/Program Files/Microsoft Dynamics AX/50/AifWebServices/
LOG: Initial PrivatePath = C:\Program Files\Microsoft Dynamics AX\50\AifWebServices\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft Dynamics AX\50\AifWebServices\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/microsoftdynamicsaxaif50/5f42b57f/8609327f/microsoft.dynamics.integrationframework.service.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/microsoftdynamicsaxaif50/5f42b57f/8609327f/microsoft.dynamics.integrationframework.service/microsoft.dynamics.integrationframework.service.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Dynamics AX/50/AifWebServices/bin/microsoft.dynamics.integrationframework.service.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.

Event Viewer has the following information:

WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/25753987
Exception: System.ServiceModel.ServiceActivationException: The service '/MicrosoftDynamicsAXAif50/salesorderservice.svc' cannot be activated due to an exception during compilation. The exception message is: Could not load file or assembly 'microsoft.dynamics.integrationframework.service' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\web.config line 59). ---> System.Configuration.ConfigurationErrorsException: Could not load file or assembly 'microsoft.dynamics.integrationframework.service' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\web.config line 59) ---> System.BadImageFormatException: Could not load file or assembly 'microsoft.dynamics.integrationframework.service' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'microsoft.dynamics.integrationframework.service'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = MyDomain\axbc
LOG: DisplayName = microsoft.dynamics.integrationframework.service
(Partial)
LOG: Appbase = file:///C:/Program Files/Microsoft Dynamics AX/50/AifWebServices/
LOG: Initial PrivatePath = C:\Program Files\Microsoft Dynamics AX\50\AifWebServices\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft Dynamics AX\50\AifWebServices\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/microsoftdynamicsaxaif50/5f42b57f/8609327f/microsoft.dynamics.integrationframework.service.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/microsoftdynamicsaxaif50/5f42b57f/8609327f/microsoft.dynamics.integrationframework.service/microsoft.dynamics.integrationframework.service.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Dynamics AX/50/AifWebServices/bin/microsoft.dynamics.integrationframework.service.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.

--- End of inner exception stack trace ---
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.GetCompiledCustomString(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
--- End of inner exception stack trace ---
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
Process Name: w3wp
Process ID: 7900

Contents of my C:\Program Files\Microsoft Dynamics AX\50\AifWebServices\web.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="3.5" />
<supportedRuntime version="v2.0.50727" />

</startup>
<system.web>

<customErrors mode="RemoteOnly" />

<authentication mode="Windows"/>

<httpModules>
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />
</httpModules>

<trust level="Full" originUrl="" />

</system.web>

<!-- Configure tracing information for debugging in production version -->
<system.diagnostics>
<!-- This is relevant only for DEBUG build.
This disables assert dialog when Debug.Assert() is used in code. Since code will be running in IIS (no-ui)
we have to disable dialogs. We will redirect it to a file
Please make sure to give a full file path to where the assertion file should be located
-->
<assert assertuienabled="false" logfilename="AifDebugAsserts.webinfo" />

<!-- This is used for enabling tracing in retail and debug builds.
AIF Service processing stack outputs information messages used for debugging.
Possible values for switch are Off, Warning, Information, Critical, Verbose.
Change switchValue to Information to enable this.
-->
<sources >
<source name="AifServiceProcessing" switchValue="Off">
<listeners >
<add name="TextWriterListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="AifServiceTrace.webinfo" >
</add>
<remove name="Default" />
</listeners>
</source>
</sources>
</system.diagnostics>

<appSettings>
<!--
This is the name of the 'system wide'/'global' configuration that should be used to log on using .NET Business Connector.
The default case of the value being empty is - Business connector will log on to Microsoft Dynamics using the first available
configuration from the registry and use it.
The value of the key can be:
1. The name specified for the new global configuration.
2. The file name (with full path) to the exported configuration.
If this value is specified, this configuration is used to log on to Microsoft Dynamics
Usage: Override this value in case you dont want the default behavior of configuration.
E.g. connect to different AOS server, or use a different default company etc.
-->
<add key="BUSINESS_CONNECTOR_CONFIGURATION" value=""/>
</appSettings>


<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingWindowsAuth">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>

<services>
<service behaviorConfiguration="serviceBehaviorConfiguration"
name="Microsoft.Dynamics.IntegrationFramework.Service.CustomerService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingWindowsAuth"
bindingNamespace="">schemas.microsoft.com/.../services"
contract="Microsoft.Dynamics.IntegrationFramework.Service.CustomerService" />
</service>
<service behaviorConfiguration="serviceBehaviorConfiguration"
name="Microsoft.Dynamics.IntegrationFramework.Service.AddressService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingWindowsAuth"
bindingNamespace="">schemas.microsoft.com/.../services"
contract="Microsoft.Dynamics.IntegrationFramework.Service.AddressService" />
</service>
<service behaviorConfiguration="serviceBehaviorConfiguration"
name="Microsoft.Dynamics.IntegrationFramework.Service.SalesOrderService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingWindowsAuth"
bindingNamespace="">schemas.microsoft.com/.../services"
contract="Microsoft.Dynamics.IntegrationFramework.Service.SalesOrderService" />
</service>
</services>

<behaviors>
<serviceBehaviors>
<behavior name="serviceBehaviorConfiguration">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

I've tried different settings in the highlighted Startup  tag to no avail.

Thanks.

Parents
No Data
Reply
  • Some additional information:

    When I click the generate button on the Services form, the following file is created: "C:\Program Files\Microsoft Dynamics AX\50\AifWebServices\Bin\microsoft.dynamics.integrationframework.service.dll" 

    I used the following PowerShell commands  and the result was V4.0.30319

    $path = "C:\Program Files\Microsoft Dynamics AX\50\AifWebServices\Bin\microsoft.dynamics.integrationframework.service.dll"
    [Reflection.Assembly]::ReflectionOnlyLoadFrom($path).ImageRuntimeVersion

    If I run the same PowerShell commands on my production server, I get 2.0.50727.

    This proves the error message in my DEV environment that the the assembly is built by a newer runtime.

    So, the question becomes -- how do I force the 2.0.50727 runtime when I'm generating the DLL?

    Any thoughts?

    Thanks

Children
Related
Recommended