Asked by:
Database Synchronization - Wcf IIS 7.0 showing incorrect path.

Question
-
I am currently using Wcf with Sync application.
I have deployed the application in C:/Inetpub/wwwroot/DbSyncWcfService of my server.
I have deployed from path D:\MySyncService\MySyncServiceProject\MySyncService\MySyncService\DBSyncWCF from my machine.I am successfully able to browse the application.
But when I use the WCf Application. It gives me an error as below.DBSyncHandler :: initScopeInfo() :: Exception ==System.ServiceModel.FaultExcepti
on`1[System.ServiceModel.ExceptionDetail]: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not responding. (F
ault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDe
tailInFaults=true, whose value is:System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed
prior to completion of the operation or the server is not responding.
at DBSyncWcfService.DBSyncService.InitializeScopeConfig(String xmlasstring) i
n D:\MySyncService\MySyncServiceProject\MySyncService\MySyncService\DBSyncWCF\DB
SyncService.svc.cs:line 92
at SyncInvokeInitializeScopeConfig(Object , Object[] , Object[] )I had successfully synched the same application the last time it had used .But there some changes in deployment of WCf which were made.
Therefore keeping the Web Config as it is I tried deployed the rest changes and checked with browsing the url from my machine successfully.
Basically I am surprised as the path it is showing is from my physical path.
- Edited by sakulkarni83 Wednesday, August 22, 2012 9:00 AM
Wednesday, August 22, 2012 8:44 AM
All replies
-
you're error is connecting to the database. nothing to do with paths. that's just showing you the line of code where it failed.Wednesday, August 22, 2012 9:03 AM
-
Hi June,
We have the same combination a .net Web Application and Sql server database combination which works fine.Its in the case of Sync Wcf application where it fails.Also if the Wcf application is hosted inpath C:\inetpub\DbScyncWcfService then I should not get the stacktrace for
D:\MySyncService\MySyncServiceProject\MySyncService\MySyncService\DBSyncWCF\DB
SyncService.svc.cs:line 92.Thats why I am surprised.
Thanks in Advance.
Wednesday, August 22, 2012 10:34 AM -
the source code file path in the stack trace has nothing to do with where you deployed the app. that's the path when you built the project in VS.
a quick search on "stack trace file path" would tell you that.
- Edited by JuneT Wednesday, August 22, 2012 3:06 PM
Wednesday, August 22, 2012 2:56 PM -
Hi June,
I got the real issue.Basically it is trying provisioning a table which has 26852807 rows.
It also has 99 columns.That might be an issue.What shall be the corrective measures for that.Below is the Source code.
//Connection string
//Data Source=10.0.2.64;Initial Catalog=CRM_PROD_20_FEB_2012;Integrated Security=False;User ID=sa;Password=Puppy123;Connect Timeout=0serverConfig = new SqlSyncScopeProvisioning(serverConn, SqlSyncScopeProvisioningType.Template);
serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
//-- Loads the scope descriptioninitScopeTableInfo(serverConfig, serverConn);
// Configure the scope and change-tracking infrastructure.serverConfig.SetUseBulkProceduresDefault(false);
serverConfig.Apply();
- Edited by sakulkarni83 Friday, August 24, 2012 1:23 PM
Friday, August 24, 2012 12:32 PM -
set the CommandTimeout property, e.g. serverConfig.CommandTimeout = <timeout value>
Also, any specific reason why you're disabling bulk procedures?
Saturday, August 25, 2012 2:36 AM -
Hi,
I am still Connection Timeout for 120 secs.I am disabling Bulk procedures for rules.Basically I an trying to accomodate rules in database.
Below is the discussion link.
Regards,
Sachin K
- Edited by sakulkarni83 Monday, August 27, 2012 6:31 AM
Monday, August 27, 2012 6:15 AM -
you are provisioning a table with 28 million rows, are you sure your server can cope with the 28 million inserts in the tracking table in 2 minutes?Monday, August 27, 2012 6:33 AM
-
Hi June
Below are few observations/querries.
1.I have checked with the Server side with a where clause.Out of 26852807 rows,For a particular Town_Cd_C ,it is only 397 columns.It took around 52 secs .
2. What impact it will make if I enable bulk procedures?
3. At a different(development) environment,I am successfully able to Provision and Sync the table.
dbo.MBC_CONSUMER_BILL_INTF - (Rows * Columns) 1437*99 Total no of rows and where clause also same.
dbo.MBC_CONSUMER_RECEIPT_INTF -(Rows * Columns) 65554* 26 Total no of rows and where clause also same.
4.At production Environment
I am failing to Sync the application.
dbo.MBC_CONSUMER_BILL_INTF - (Rows * Columns) 26852807*99 With Where Clause 397 rows onlyi.e Out of 26852807 rows,only 397 rows needs to be synched
dbo.MBC_CONSUMER_RECEIPT_INTF -(Rows * Columns) 14909858* 26i.e Out of 14909858 rows,only 17 rows needs to be synched
- Edited by sakulkarni83 Monday, August 27, 2012 7:54 AM
Monday, August 27, 2012 7:53 AM -
the tracking is not per scope, its per table. the WHERE clause has no bearing in populating the tracking table. each row in the table you're trying sync will have a row in the tracking table.
bulk procedures enables faster change application, assuming you disabled it and you have 100 inserts, its going to send 100 insert statements. if you enable bulk procedures, it will only call the bulk stored procedure once
Monday, August 27, 2012 8:12 AM -
Hi June,
Still I am getting the same error.I have made the change as mentioned below.
The Connection String has Timeout as 360.
Also For that particular table I have tried to enable bulk procedures.
Please let me know for any direction where I can check upon.if (serverConfig.Tables[0].LocalName != "[dbo].[MBC_CONSUMER_BILL_INTF]")
serverConfig.SetUseBulkProceduresDefault(false);
else
serverConfig.CommandTimeout = 360;
serverConfig.SetUseBulkProceduresDefault(
true);serverConfig.Apply();
Also there is a table called MBC_CONSUMER_INF which has 2583901 rows and 39 columns.
I am successfully able to PRovision (filtered) and Sync the application.Monday, August 27, 2012 10:20 AM -
the setusebulkproceduresdefault is at the scope level, not per table. and it has nothing to do with your provisioning timeout. its for applying changes.
if you're still getting the error, then your timeout is still not enough. if you want test it, try to select even just the pk of the table and insert it in another table and see how long it takes.
or script the provisioning and run it yourself.
Monday, August 27, 2012 10:27 AM -
Hi June,
I created below temp table and inserted only primary key values.
It took me around 67 secs.Is there any other direction I can look upon?
Create Table MBC_CONSUMER_BILL_INTF_PKTRACK
(
[BILL_MTH] [varchar](4) NOT NULL,
[CONSUMER_NO] [varchar](12) NOT NULL)
insert into MBC_CONSUMER_BILL_INTF_PKTRACK
select BILL_MTH,CONSUMER_NO from MBC_CONSUMER_BILL_INTFMonday, August 27, 2012 12:57 PM -
67 secs for the 26M records?Monday, August 27, 2012 2:33 PM
-
Thanks June,
It seems a time Out issue.
When the respective tracking table is created by framework, is it a bulk insert activity.
Currently I am trying to create a temporary table , and on insertions of 26852807 rows with say 20 columns.Will check the time taken to do the activity.Set that time to do further actions.If its a bulk insertion activity I suppose it will definitely take less time.
Regards,
Sachin K
Friday, September 14, 2012 9:04 AM -
unfortunately, it is not a bulk operation.
Friday, September 14, 2012 9:10 AM -
Hi June,
I have successfully Provisioned the table by keeping timeout as 2400.
I have checked the count.But I got below mentioned error during first time Provisioning of the table...
Filter parameters count ==1
DBSyncXMLUtil :: getAttributeValue() :: attrValue ==@TOWN_CD_C
DBSyncHandler :: initScopeInfo() :: Exception ==Microsoft.Synchronization.Data.DbProvisioningException:
A SqlException occurred when checking the FilterParameter values given to the procedure '[dbo].[MBC_CONSUMER_RECEIPT_INTF_selectchanges]
' for table '[dbo].[MBC_CONSUMER_RECEIPT_INTF]'. See the inner exception for more details.
---> System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the server is not responding.But later I did not get any issues and I started my Syncronization process.
Later during Syncronization I got the below mentioned errors....
DBSyncOrchestrator :: Synchronize() :: Exception ==System.ServiceModel.FaultExce
ption`1[System.ServiceModel.ExceptionDetail]: Cannot enumerate changes at the Re
lationalSyncProvider for table 'dbo.MBC_CONSUMER_RECEIPT_INTF'. Check the inner
exception for any store-specific errors. (Fault Detail is equal to An Exception
Detail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
Microsoft.Synchronization.Data.DbSyncException: Cannot enumerate changes at the RelationalSyncProvider for table 'dbo.MBC_CONSUMER_RECEIPT_INTF'. Check the inn
er exception for any store-specific errors. ----> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the op
eration or the server is not responding.Are these both the errors interrelated....
Tuesday, September 18, 2012 8:50 AM -
maybe. hard to tell.
have you tried increasing the commandtimeout during synching?
run SQL Profiler and see the SQL being sent. run the SQL being sent manually and see if it runs and how long does it take.
i would also look at the specific selectchanges stored proc it complains about to see if its correct.
Tuesday, September 18, 2012 8:58 AM -
Hi June,
exec [dbo].[MBC_CONSUMER_RECEIPT_INTF_selectchanges] @sync_min_timestamp=0,@sync_scope_local_id=58,@sync_scope_restore_count=0,@sync_update_peer_key=1,@TOWN_CD_C=N'014' come
is the command.It takes around 35 secs when run manually. In profiler it is showing just 30 secs.I am also attaching the error Stack Trace..
Microsoft.Synchronization.Data.RelationalSyncProvider.EnumerateChangesInternal(DbSyncScopeMetadata scopeMetadata)
I suppose there seems a problem with connection string..
Microsoft.Synchronization.Data.RelationalSyncProvider.GetChanges(DbSyncScopeMetadata scopeMetadata, DbSyncSession DbSyncSession, UInt32 memoryBatchSize)
Microsoft.Synchronization.Data.RelationalSyncProvider.GetChangeBatch(UInt32 batchSize, SyncKnowledge destinationKnowledge, Object& changeDataRetriever)
DBSyncWcfService.RelationalWebSyncService.GetChanges(UInt32 batchSize, SyncKnowledge destinationKnowledge) in D:\DatabaseSynchronization\DBSyncWcfService\RelationalWebSyncService.cs:line 82
SyncInvokeGetChanges(Object , Object[] , Object[] )
System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet).- Edited by sakulkarni83 Tuesday, September 18, 2012 12:43 PM
Tuesday, September 18, 2012 11:45 AM -
try setting the command time out when synching as well.Wednesday, September 19, 2012 2:20 AM
-
What June is referring to is, for example, the SqlSyncProvider.CommandTimeout property which is available in SyncFx 2.1. The default value is 30 seconds.
So, for example, if you have lots of records in a DB that will be synced and it is a low power machine (e.g. ram starved), then the TableName_SelectChanges SP can take more that 30 seconds and so times out and throws an exception. Changing the property can avoid this timeout. This is very different than the timeout specified in the connection string which is exactly that, a timeout on the connection being established.
HTH
Steve
Wednesday, September 19, 2012 4:56 AM -
Hi June,
My Old Source Code was as below.
new SqlSyncProvider(scopeName, localConn, null, schemaName),RemoteProvider11,
scopeName
);
Therefore at DBSyncOrchestrator the Constructor goes as mentioned below.
public DBSyncOrchestrator(RelationalSyncProvider localProvider, KnowledgeSyncProvider remoteProvider,string scopeName){
this._localProvider = localProvider;
this._remoteProvider = remoteProvider;
this._scopeName = scopeName;
}
I have changed the Source Code to
SqlSyncProvider provider = new SqlSyncProvider(scopeName, localConn, null, schemaName);
provider.CommandTimeout = 60;
DBSyncOrchestrator sync = new DBSyncOrchestrator(
// new SqlSyncProvider(scopeName, localConn, null, schemaName),
provider,
RemoteProvider11,
scopeName
);Still I see the execution of Stored Procedure for 30 secs only in Sql Profiler.
Thursday, September 20, 2012 8:41 AM -
which is it timing out ? the local provider or the remote provider?
Thursday, September 20, 2012 8:58 AM -
How will I come to know whether the timeout is due to local provider or remote provider?
I have set local provider to 60 secs ,but still it is breaking out in 30 secs.....Also Remote provider doesnot have Command TimeOut issue as local provider.
Below mentioned is Local Provider.
provider.CommandTimeout = 60;
Regards,
Sachin K
Thursday, September 20, 2012 10:16 AM -
looking at your error, its timing out on the WCF service side, so that's the remote provider. go find the code in the WCF where you instantiate a SqlSyncProvider and set the timeout there.Thursday, September 20, 2012 10:29 AM
-
Hi June,
Thanks Once again.But I am still not able to understand that even if I mentioned TimeOut as 2400 in Connection String,still why do I need to mention Timeouts differently in Providers?How do they differ from ConnectionStrings?
Regards,
Sachin K
Thursday, September 20, 2012 11:35 AM -
Connection timeout is different from command timeout.
the former is the timeout for establishing a connection, the latter is the timeout when executing a command.
Thursday, September 20, 2012 12:07 PM