locked
Sync Sample Database Sync SQL Server and SQL Compact N-Tier with WCF Problems RRS feed

  • Question

  • Hi,

       I am trying to get the 'Database Sync SQL Server and SQL Compact N-Tier with WCF' (https://code.msdn.microsoft.com/Database-Sync-SQL-Server-7e88adab) sample working as I require similar functionality in a project. Everything compiles ok but I get the below errors in 2 dialog boxes.

    System.BadImageFormatException: Could not load file or assembly 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format.
    File name: 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe'
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
       at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)

    === Pre-bind state information ===
    LOG: Where-ref bind. Location = D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe
    LOG: Appbase = file:///D:/Protex Applications/MS Sync DB Over Internet/Database Sync SQL Server and SQL Compact N-Tier with WCF/C#/WebSyncContract/WebSyncContract/bin/x86/Debug
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in LoadFrom load context.
    WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
    LOG: Using application configuration file: D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe.config
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
    LOG: Attempting download of new URL file:///D:/Protex Applications/MS Sync DB Over Internet/Database Sync SQL Server and SQL Compact N-Tier with WCF/C#/WebSyncContract/WebSyncContract/bin/x86/Debug/WebSyncContract.exe.
    ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.


    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


    System.BadImageFormatException: Could not load file or assembly 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format.
    File name: 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe'
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
       at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

    Any help appreciated.

    Thanks

    Paul.


    Paul Wainwright

    Tuesday, October 28, 2014 12:06 PM

Answers

  • Hi,

       I am trying to get the 'Database Sync SQL Server and SQL Compact N-Tier with WCF' (https://code.msdn.microsoft.com/Database-Sync-SQL-Server-7e88adab) sample working as I require similar functionality in a project. Everything compiles ok but I get the below errors in 2 dialog boxes.

    System.BadImageFormatException: Could not load file or assembly 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format.
    File name: 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe'
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
       at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)

    === Pre-bind state information ===
    LOG: Where-ref bind. Location = D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe
    LOG: Appbase = file:///D:/Protex Applications/MS Sync DB Over Internet/Database Sync SQL Server and SQL Compact N-Tier with WCF/C#/WebSyncContract/WebSyncContract/bin/x86/Debug
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in LoadFrom load context.
    WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
    LOG: Using application configuration file: D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe.config
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
    LOG: Attempting download of new URL file:///D:/Protex Applications/MS Sync DB Over Internet/Database Sync SQL Server and SQL Compact N-Tier with WCF/C#/WebSyncContract/WebSyncContract/bin/x86/Debug/WebSyncContract.exe.
    ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.


    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


    System.BadImageFormatException: Could not load file or assembly 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format.
    File name: 'file:///D:\Protex Applications\MS Sync DB Over Internet\Database Sync SQL Server and SQL Compact N-Tier with WCF\C#\WebSyncContract\WebSyncContract\bin\x86\Debug\WebSyncContract.exe'
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
       at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

    Any help appreciated.

    Thanks

    Paul.


    Paul Wainwright


    Got it working. Needed to change Configuration Manager to x64

    Paul Wainwright

    • Marked as answer by pr_wainwright Tuesday, October 28, 2014 1:19 PM
    Tuesday, October 28, 2014 1:18 PM