In the existing code the size of transactionEntities is growing and in the almost final statement we've got
transactionEntities.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
For the moment there is no exception in a log , however clearly something went wrong, as there was no final message logged ( "Finished ...." ) . Actually 2 questions here
- Is there way to understand what's happening
- Would it be possible somehow to save in batches mimicking the single statement, as transactionEntities keeps growing anyway.
Extracting service code into console application possibly fix the problem for the moment ( triggered as one way service in-house, so no real need for the service as such ) , but doesn't solve the issue for the existing service.
For question #1 - you can turn on diagnostics on your WCF service
In your web (or app) config:
1) Add System.Diagnostics section anywhere under configuration element. You can replace path with which ever path you want the files to be stored at.
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\temp\services_messages.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelMessageLoggingListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
<filter type="" />
</add>
<add initializeData="C:\temp\services_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
2) Under system.ServiceModel add following:
<diagnostics wmiProviderEnabled="false">
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
3) Under C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ start SvcTraceViewer.exe. Load both message trace (services_messages.svclog) and service trace log (services_tracelog.svclog). You can either drag drop files in the tool or open one then add another
4) Look for red bold letters for a problem.
If you want to make your experience editing the WCF configuration more palatable you can use SvcConfigEditor.exe which is found under same folder as SvcTraceViewer.exe (#3). Just open the config file and you should see Diagnostics folder which will allow you to start/stop and configure diagnostics.