0
votes

I had generate data model from linq2db T4 template and develop and debug my azure function local, setting up connection string in local.settings.json. After deploy function to Azure I set up same connection string to my Azure SQL Database at Application settings page of Azure portal, but function cannot connect to database, it throws this exception:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsDashboard": "",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
  },
  "ConnectionStrings": {
    "IntegrationSqlDb": "constr here"
  }
}

Portal Application settings

1
Please show how you defined it locally and in App settingsMikhail Shilkov
I update questionreddto

1 Answers

0
votes

Solve problem by replacing

public IntegrationSqlDbDB(string configuration)
    : base(configuration)
{
    InitDataContext();
}

with

public IntegrationSqlDbDB() : base("IntegrationSqlDb")
{
    InitDataContext();
}

in generated by T4 template code. Please excuse me, just novice.