locked
Cannot run sample on x64 because of SqlCeEngine ??? RRS feed

  • Question

  • I am trying to build and run Offline Oracle Sync Sample on my W2003 Server x64 and got an error:

     

    if (false == File.Exists(dbPathTextBox.Text))

    {

    SqlCeEngine clientEngine = new SqlCeEngine(connString); //<------------------------here

    clientEngine.CreateDatabase();

    clientEngine.Dispose();

    }

     

    Message = "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

    Path is correct...

    What is wrong?

     

    Thank you
    • Moved by Max Wang_1983 Friday, April 22, 2011 9:07 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, January 9, 2008 4:10 PM

Answers

  • Oleg,

     

    You are right. SQLCE is not 64bit ready yet, check out this blog post for more details.

     

    Thanks

     

    Saturday, January 12, 2008 7:31 PM

All replies

  • I do not believe there is currently a 64 bit version of SQL Server Compact which is likely why you are getting this error.  Can you try to compile the binary for 32-bit, not for "Any" architecture?  You can do this in VS. 

     

    Liam

    Wednesday, January 9, 2008 11:04 PM
  •  

    Yes, you are right, I set x86 and now it works.

    But another error: Exception Has been thrown by the target of an invocation" ...

     

     

     

     

    Thursday, January 10, 2008 9:55 AM
  • Can you give me more details as to when this happens and whether it is a specific line of code causing this error?

     

    Thursday, January 10, 2008 6:06 PM
  • Hi,

    I am trying to run sample OfflineAppDemo-Batching, it is line near 127,

     

    SyncStatistics syncStats = syncAgent.Synchronize();

     

     

    Regards,

    Oleg.

     

    Thursday, January 10, 2008 6:25 PM
  • Can I ask for the full exception? i.e. message, stack , inner exception?

     

    Thanks,

    Liam

    Thursday, January 10, 2008 6:50 PM
  •  

    Yes, yes, thank you for this beautiful large font  ;-)

     

    > SyncApplication.exe!SyncApplication.SyncForm.buttonSynchronize_Click(object sender = {Text = "&Synchronize"}, System.EventArgs e = {X = 94 Y = 9 Button = Left}) Line 139 C#
      System.Windows.Forms.dll!System.Windows.Forms.Control.OnClick(System.EventArgs e) + 0x6a bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Button.OnClick(System.EventArgs e) + 0x49 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent = {X = 94 Y = 9 Button = Left}) + 0xc8 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0x2f7 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x526 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message m) + 0xc7 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Button.WndProc(ref System.Windows.Forms.Message m) + 0x2b bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x36 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes 
      [Native to Managed Transition] 
      [Managed to Native Transition] 
      System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x2f1 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x17d bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x53 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x2e bytes 
      SyncApplication.exe!SyncApplication.OfflineApp.Main() Line 21 + 0x1a bytes C#
    -----------------------------------------

     

     

    -  exp {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException}
    +  [System.Reflection.TargetInvocationException] {"Exception has been thrown by the target of an invocation."} System.Reflection.TargetInvocationException
      _className null string
      _data null System.Collections.IDictionary
      _dynamicMethods null object
      _exceptionMethod null System.Reflection.MethodBase
      _exceptionMethodString null string
      _helpURL null string
      _HResult -2146232828 int
    +  _innerException {"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\\NETWORK SERVICE'.\n   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)\n   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)\n   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)\n   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)\n   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)\n   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)\n   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)\n   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)\n   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)\n   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)\n   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)\n   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)\n   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)\n   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)\n   at System.Data.SqlClient.SqlConnection.Open()\n   at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.Connect()\n   at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetSchema(Collection`1 tableNames, SyncSession syncSession)\n   at Service.GetSchema(Collection`1 tableNames, SyncSession sessoin) in c:\\Inetpub\\wwwroot\\SyncWebService\\App_Code\\Service.cs:line 304\n   --- End of inner exception stack trace ---"} System.Exception {System.Web.Services.Protocols.SoapException}
      _message "Exception has been thrown by the target of an invocation." string
      _remoteStackIndex 0 int
      _remoteStackTraceString null string
      _source null string
    +  _stackTrace {Dimensions:[192]} object {sbyte[]}
      _stackTraceString null string
      _xcode -532459699 int
    +  _xptrs 0 System.IntPtr
    +  Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
      HelpLink null string
      HResult -2146232828 int
    +  InnerException {"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\\NETWORK SERVICE'.\n   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)\n   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)\n   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)\n   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)\n   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)\n   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)\n   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)\n   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)\n   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)\n   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)\n   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)\n   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)\n   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)\n   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)\n   at System.Data.SqlClient.SqlConnection.Open()\n   at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.Connect()\n   at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetSchema(Collection`1 tableNames, SyncSession syncSession)\n   at Service.GetSchema(Collection`1 tableNames, SyncSession sessoin) in c:\\Inetpub\\wwwroot\\SyncWebService\\App_Code\\Service.cs:line 304\n   --- End of inner exception stack trace ---"} System.Exception {System.Web.Services.Protocols.SoapException}
      IsTransient false bool
      Message "Exception has been thrown by the target of an invocation." string
      Source "mscorlib" string
      StackTrace "   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)\r\n   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)\r\n   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)\r\n   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetSchema(Collection`1 tableNames, SyncSession syncSession)\r\n   at Microsoft.Synchronization.SyncAgent.InitClientSchema()\r\n   at Microsoft.Synchronization.SyncAgent.Synchronize()\r\n   at SyncApplication.SyncForm.buttonSynchronize_Click(Object sender, EventArgs e) in E:\\Download\\SyncServices\\OfflineAppDemo-Batching\\app\\SyncForm.cs:line 127" string
    +  TargetSite {System.Object _InvokeMethodFast(System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeTypeHandle)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
    +  Static members  
    ------------------------------------------------------------------------------------

     

     

    I see: may be it is authorization error?

     

     

    Thank you.

     

    Oleg.

     

     

    Thursday, January 10, 2008 6:57 PM
  • This exception seems to be an server side authentication issue.

     

    +  _innerException {"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\\NETWORK SERVICE'.\n  

     

    Can you put a try/catch block at the server side GetSchema() method to confirm this? Also can you tell us what is the inpersonation you used for your IIS server?

     

     

    Friday, January 11, 2008 12:47 AM
  • great! thank you, it is solved. For this example I connected to the SQL Server using SQL Server auth.

     

    After this I run sample, click on Synchronize button and receive error: "Method Service.GetChanges can not be reflected" ....

     

    What can it be?...

     

    How to catch it?

     

    Thank you.

     

    Oleg.

     

     

    Friday, January 11, 2008 6:32 AM
  • Oleg,

     

    You are right. SQLCE is not 64bit ready yet, check out this blog post for more details.

     

    Thanks

     

    Saturday, January 12, 2008 7:31 PM