0

I'm trying to do a simple CRUD application with EF Core and Azure Table (from Azure Storage Account).

I'm passing name of the storage account as database name (The docs aren't exactly clear on that)

services.AddDbContext<HomioDbContext>(options =>    
                options.UseCosmos(
                    "https://homiostorage.table.core.windows.net/",
                    "{Account Key}",
                    databaseName: "{name of storage account}"));

Doing any db operation throws following error (The value for one of the HTTP headers is not in the correct format)

CosmosException;StatusCode=BadRequest;SubStatusCode=0;ActivityId=00000000-0000-0000-0000-000000000000;RequestCharge=0;Message=Response status code does not indicate success: 400 Substatus: 0 Reason: (<?xml version="1.0" encoding="utf-8" standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">  <code>InvalidHeaderValue</code>  <message xml:lang="en-US">The value for one of the HTTP headers is not in the correct format.RequestId:cdef27c9-3002-0084-60dd-d9b8b0000000Time:2020-02-02T15:29:31.9748413Z</message></error>, Request URI: /, RequestStats: , SDK: Windows/10.0.18363 cosmos-netstandard-sdk/3.3.0).;Diagnostics

Been stuck at it for a while now... Could really use some help!

6
  • Just a wild guess, can you try providing the name of the table for databaseName? Commented Feb 2, 2020 at 15:39
  • 1
    Another thing I noticed here (learn.microsoft.com/en-us/ef/core/providers/cosmos/…) is that it is only available for SQL API and not Table Storage API. Could that be the reason? Commented Feb 2, 2020 at 15:47
  • @GauravMantri Is it the case? I was not familiar with that.. That could be the reason I suppose.. Will check up some sources on that! Commented Feb 2, 2020 at 15:57
  • @GauravMantri Yeah, that was the case.. Thanks! Commented Feb 2, 2020 at 16:00
  • Meaning no support for Table Storage, right? Commented Feb 2, 2020 at 16:01

1 Answer 1

3

As per the documentation here, EF Core Provider for Cosmos DB only supports SQL API only (at least as of writing this answer) and you are using it against Table Storage. That's the reason you're getting this error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.