How to debug WCF dataservice

1.6k views Asked by At

I have a written dataservice for my windowsphone application and i'm trying to savechanges to this dataservice. To do this i call BeginSaveChanges:

    Context.AddToMeasurements(temp);
    Context.BeginSaveChanges(SaveChangesOptions.Batch, SaveChangesComplete, Context);

The callback of this function returns an error when EndSaveChanges is called.

private void SaveChangesComplete(IAsyncResult result)
{
    // use a dispatcher to make sure the async void 
    // returns on the right tread.
    Deployment.Current.Dispatcher.BeginInvoke(() =>
    {

        DataServiceResponse WriteOperationResponse = null;

        Context = result.AsyncState as MeasurementEntities;

        try
        {
             WriteOperationResponse = Context.EndSaveChanges(result);
             Debug.WriteLine("Batch State:");
             Debug.WriteLine(WriteOperationResponse.BatchStatusCode);
        }
        catch (DataServiceRequestException ex)
        {

            Debug.WriteLine(ex.Message);
        }
        catch (InvalidOperationException ex)
        {
            Debug.WriteLine(ex.Message);
        }

    });        
}

The Error the endsavechanges returns:

An exception of type 'System.Data.Services.Client.DataServiceClientException' occurred in Microsoft.Data.Services.Client.WP80.DLL and wasn't handled before a managed/native boundary
An exception of type 'System.Data.Services.Client.DataServiceRequestException' occurred in Microsoft.Data.Services.Client.WP80.DLL and wasn't handled before a managed/native boundary
A first chance exception of type 'System.Data.Services.Client.DataServiceRequestException' occurred in Microsoft.Data.Services.Client.WP80.DLL
An exception of type 'System.Data.Services.Client.DataServiceRequestException' occurred in Microsoft.Data.Services.Client.WP80.DLL and wasn't handled before a managed/native boundary
An error occurred while processing this request.

I would like to see some more detailed information about these errors, or if someone knows what they mean that also would be appreiciated, but how can I accomplish (more details on the dataservice) within visual studio?

ps, i have allready added:

config.UseVerboseErrors = true;

and

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]

to my dataservice.

please help :)

edit:


When i remove the Try construction and just execute a EndSaveChanges method. I can read the innerExeptions, which is:

Cannot insert explicit value for identity column in table 'Measurement' when IDENTITY_INSERT is set to OFF.

any idea's what this means?

1

There are 1 answers

2
Ehsan On BEST ANSWER

Cannot insert explicit value for identity column in table 'Measurement' when IDENTITY_INSERT is set to OFF.

it means that you are not passing any value to Measurement column and it is a mandatory field in the database. You need to pass value to it.