DataServiceRequestException was unhandled by user code. An error occurred while processing this request.

Make sure you please read the previous blog post on StorageException otherwise this would not make sense. Once we change the code in the constuctor and forget to change the table name this exception would occur. This exception occurs usually when

1. you do not have the table name which you are requesting. This could occur if you try to delete something and try to access it concurrently from some other thread. Or if you do not have the table with the same name in your storage.

2. You may just have the name there in the form of 'Emailaddress' and you are accessing it with a similar name which is CamelCased for example, 'EmailAddress'. 

DataServiceRequestException was unhandled by user code
 An error occurred while processing this request.

 If you follow the post from the previous post, this exception occurs at a different place. Even though the solution is same, the exception is different and hence somewhat misleading. The exception occurs at the save changes line and the user would normally think that the AddObject function ran well.

    public void AddEmailAddress(EmailAddressEntity emailAddressTobeAdded)

            AddObject("EmailAddress", emailAddressTobeAdded);


 However, avoid the naming of the EmailAddress in the AddObject method as CamelCasing.  So changing it to "emailaddress" or "Emailaddress" fixes it. Again, it could be some other factors owing to which this exception might occur.At the time of writing this post, I had seen difference in the 32-bit environment and 64-bit environment so please cross check this. Feel free to email me the code and i shall be happy to help.


  • here is the code which is throwing the exception

    public void Insert(ContactDataModel newItem)
    _ServiceContext.AddObject(ContactDataServiceContext.ContactTableName, newItem);


  • can you please let me know what does the string ContactTableName look like? For example, it might be "EmailAddress" and if you change that to "emailaddress" or "EmailAddress" it should work. However, this was a problem in the earlier versions and this might have been fixed by now.

Comments have been disabled for this content.