web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Webservice Error - Could not load file or Assembly 'Microsoft.Dynamics.BusinessConnectorNet.dll'

(0) ShareShare
ReportReport
Posted on by 55

 Hi,

I've create a webservice using BusinessConnector to communicate with Microsoft Dynamics AX2009.

I've developped it by adding reference to Microsoft.Dynamics.BusinessConnectorNet.dll into webservice.
The Path for dll is correct but when I try to test webservice, I receive an error loading file or assembly !!!

Here is the error :

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Could not load file or assembly 'Microsoft.Dynamics.BusinessConnectorNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Dynamics.BusinessConnectorNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Dynamics.BusinessConnectorNet' could not be loaded.


=== Pre-bind state information ===
LOG: User = XXX\xxxxxxx
LOG: DisplayName = Microsoft.Dynamics.BusinessConnectorNet
(Partial)
LOG: Appbase = file:///C:/AXWebserviceISA/AXWebserviceISA/AXWebserviceISA/
LOG: Initial PrivatePath = C:\AXWebserviceISA\AXWebserviceISA\AXWebserviceISA\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\AXWebserviceISA\AXWebserviceISA\AXWebserviceISA\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/axwebserviceisa/724bc418/67e696a0/Microsoft.Dynamics.BusinessConnectorNet.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/axwebserviceisa/724bc418/67e696a0/Microsoft.Dynamics.BusinessConnectorNet/Microsoft.Dynamics.BusinessConnectorNet.DLL.
LOG: Attempting download of new URL file:///C:/AXWebserviceISA/AXWebserviceISA/AXWebserviceISA/bin/Microsoft.Dynamics.BusinessConnectorNet.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.



Stack Trace:


[BadImageFormatException: Could not load file or assembly 'Microsoft.Dynamics.BusinessConnectorNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166
System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Dynamics.BusinessConnectorNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11200744
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210
System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +502
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +476
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +116
System.Web.UI.WebServiceParser.GetCompiledType(String inputFile, HttpContext context) +77
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +231
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +89
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +564
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

Have someone any ideas ? I try to solve this point since 3 days and any solution. And I didn't find anything on the net.


Thanks for your help !

 

*This post is locked for comments

I have the same question (0)
  • Kevin Burek MSFT Profile Picture
    5 on at
    Re: Re: Webservice Error - Could not load file or Assembly 'Microsoft.Dynamics.BusinessConnectorNet.dll'

    The Dynamics Ax installer should be used to install the business connector on machines where you wish to consume it.  The BC.Net assembly will be added to the global assembly cache, and thus be available to any referencing executable.

    Alternatively, you could use gacutil.exe to add Microsoft.Dynamics.BusinessConnectorNet.dll assembly to the GAC manually.

    Thanks,
    Kevin

    http://mscommunity/disclaimer.asp

  • Community Member Profile Picture
    on at
    Re: Webservice Error - Could not load file or Assembly 'Microsoft.Dynamics.BusinessConnectorNet.dll'

    When I deploy AX reports, I got similar error as you.

     What I did is to copy those missed assemblies to C:\Windows\assembly folder where you can find a lot AX assemblies.

     Hope it can fix your error as well.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans