如何在Azure功能环境中设置linq2db连接字符串

时间:2018-03-15 20:31:26

标签: azure azure-sql-database azure-functions linq2db

我从linq2db T4模板生成数据模型,并开发和调试我的azure函数local,在local.settings.json中设置连接字符串。将功能部署到Azure后,我在Azure门户的应用程序设置页面上为我的Azure SQL数据库设置了相同的连接字符串,但是函数无法连接到数据库,它会抛出此异常:

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 个答案:

答案 0 :(得分:0)

通过替换

解决问题
public IntegrationSqlDbDB() : base("IntegrationSqlDb")
{
    InitDataContext();
}

viewForZoom

由T4模板代码生成。 请原谅我,只是新手。