-1

I am using azure function to triggerQueue with entity framework getting 'data source is not supported' error while using entity framework.My connection string is

Following is the code where I am getting error

 var connString = ConfigurationManager.ConnectionStrings["ACIGPSDBConnection"].ConnectionString;
                using (var db = new ACIGPSDBConnection(connString))
                {
                    if (!string.IsNullOrWhiteSpace(myQueueItem))
                    {
                        var breadCrumbList = JsonConvert.DeserializeObject<IList<BreadCrumb>>(myQueueItem);
                        if (breadCrumbList != null && breadCrumbList.Count() > 0)
                        {

                            var activeRouteJob = from j in db.Jobs
                                                 join rj in db.RouteJobs on j.Id equals rj.JobID
                                                 where j.IsActive == true && j.EndDate > DateTime.UtcNow &&
                                                      breadCrumbList.Any(a => a.CarrierId == rj.CarrierID)
                                                 select new RouteJobDelivery
                                                 {
                                                     RouteJobId = rj.Id,
                                                     StartDate = j.StartDate,
                                                     EndDate = j.EndDate
                                                 };
 <add name="ACIGPSDBConnection"
         connectionString="metadata=res://*/ACIGPSDataContext.csdl|res://*/ACIGPSDataContext.ssdl|res://*/ACIGPSDataContext.msl;
         provider=System.Data.SqlClient;provider connection string=&quot; 
         Data source=sqlsrv-scu-dev.database.windows.net;
         initial catalog=md_ACI-dev;user id=;password=;
         MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Tried with the follwing things 1) try with changing providerName from System.Data.EntityClient to System.Data.SqlClient 2) tried removing $quot to single quote 3) tried removing MultipleActiveResultSets=True 4)tried In azure,Select App->Application settings->New connection string->Save

Edit: code imageError Code CodeImage

2 Answers2

0

I think the problem may still be in the escaping of characters.

If there would be a quote in the connectionString value, as the value itself is enclosed in quotes. The quote in the value will be escaped to & quot ; .

I suggest you try the following:

  1. Try to hardcode this connection string into the code instead of getting it from the configuration file to see if there is any error.
  2. If you get a success in step 1, then you get back to get connection string from configuration file. But, you add a output or set a breakpoint before you use it. In this way, you can check if you get the connection string in a right format.
  3. If you want to get the connection string from Azure app settings, then replace & quot ; with a " .
Jack Jia
  • 5,268
  • 1
  • 12
  • 14
-1

Try removing MultipleActiveResultSets = True from connection string and it will works.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30