>
Got it! - I had 2 slashes in my connection string which is apparently not needed when using the @ syntax :-}
>Hi,
>
>I'm making my first foray into Microsoft's Sync Framework to help with developing an occasionally connected application.
>
>I'm following the walkthrough in the help file (version 2.1 is what I'm using). and have followed the instructions to give me this code:
>
>
using System;
>using System.Collections.Generic;
>using System.Linq;
>using System.Text;
>using System.Data;
>using System.Data.SqlClient;
>
>using Microsoft.Synchronization;
>using Microsoft.Synchronization.Data;
>using Microsoft.Synchronization.Data.SqlServer;
>
>namespace ProvisionClient
>{
> class Program
> {
> static void Main(string[] args)
> {
> // create a connection to the SyncExpressDB database
> SqlConnection clientConn = new SqlConnection(@"Data Source=QOSMIO\\SQL2008EXPRESSR2; Initial Catalog=SyncExpressDB; Integrated Security=True");
>
> // connect to server database
> SqlConnection serverConn = new SqlConnection("Data Source=QOSMIO\\SQL2012; Initial Catalog=SyncDB; Integrated Security=True");
>
> // get the description of ProductsScope from the SyncDB server database
> DbSyncScopeDescription scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope("ProductsScope", serverConn);
>
> // create server provisioning object based on the ProductsScope
> SqlSyncScopeProvisioning clientProvision = new SqlSyncScopeProvisioning(clientConn, scopeDesc);
>
> // starts the provisioning process
> clientProvision.Apply();
>
>
> }
> }
>}
>
>I get the following error on this line:
>
>SqlSyncScopeProvisioning clientProvision = new SqlSyncScopeProvisioning(clientConn, scopeDesc);
>
>Any idea what this means?
>
>System.InvalidOperationException was unhandled
> HResult=-2146233079
> Message=Instance failure.
> Source=System.Data
> StackTrace:
> at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
> at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
> at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
> at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
> at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions)
> at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
> at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
> at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions)
> at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions)
> at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
> at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
> at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
> at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
> at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
> at System.Data.SqlClient.SqlConnection.Open()
> at Microsoft.Synchronization.Data.SyncUtil.TryOpenConnection(IDbConnection connection)
> at Microsoft.Synchronization.Data.SyncUtil.OpenConnection(IDbConnection connection)
> at Microsoft.Synchronization.Data.SqlServer.SqlEditionHelper.GetEdition(SqlConnection connection)
> at Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeProvisioning.set_Connection(SqlConnection value)
> at Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeProvisioning..ctor(SqlConnection connection, DbSyncScopeDescription scopeDescription, SqlSyncScopeProvisioningType provisioningType, Boolean expectConnection)
> at Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeProvisioning..ctor(SqlConnection connection, DbSyncScopeDescription scopeDescription)
> at ProvisionClient.Program.Main(String[] args) in c:\users\frank\documents\visual studio 2010\Projects\SyncSQLServerAndSQLExpress\ProvisionClient\Program.cs:line 28
> at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
> at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
> at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
> at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
> at System.Threading.ThreadHelper.ThreadStart()
> InnerException: