连接到 Azure 数据库

connecting to Azure database

我有一个使用 SQL CE 开发的 Umbraco 站点,然后我将其更改为 SQLEXPRESS 并且可以在本地连接到这两个站点。我部署到 Azure(最初使用 CE)并且一切正常,然后我创建了一个 SQL Azure 数据库并将 SQLEXPRESS 复制到那里,这似乎再次起作用并且我可以连接到 SQL Azure 数据库使用 SQL Management Studio。

当我尝试从我的应用程序连接到 Azure 数据库时出现问题,我已经使用 Azure 连接字符串更新了 web.config,但在本地和 Azure 中我都得到 -

Value cannot be null.
Parameter name: sqlSyntax 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: sqlSyntax

Source Error: 


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 



[ArgumentNullException: Value cannot be null.
Parameter name: sqlSyntax]
   Umbraco.Core.Persistence.Repositories.PetaPocoRepositoryBase`2..ctor(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax) +120
   Umbraco.Core.Persistence.Repositories.DomainRepository..ctor(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax) +23
   Umbraco.Core.Services.DomainService.GetAll(Boolean includeWildcards) +75
   Umbraco.Web.Routing.PublishedContentRequestEngine.FindDomain() +286
   Umbraco.Web.Routing.PublishedContentRequestEngine.PrepareRequest() +15
   Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) +361
   Umbraco.Web.UmbracoModule.<Init>b__8(Object sender, EventArgs e) +80
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

知道出了什么问题吗?

我对 Umbraco 不熟悉,但你有没有关注他们网站上的 migration guide to Azure SQL

This post on MSDN also references the Azure Umbraco Acceletator.

附带说明一下,他们还有一个在 Azure 上运行的 Umbraco-as-a-Service 产品。

当 web.config 包含一个空的 umbracoDbDSN 键但填充了 umbracoConfigurationStatus 键时会发生此错误。即:

<appSettings>
  <add key="umbracoConfigurationStatus" value="7.3.4" />
  ...
</appSettings>
<connectionStrings>
  <add name="umbracoDbDSN" connectionString="" providerName="" />
  ...
</connectionStrings>

仔细检查 umbracoDbDSN connectionString 和 providerName。您可以尝试通过清空 web.config.

中 umbracoConfigurationStatus 的值在 SQL Azure 数据库中重新安装 Umbraco

替换

<add key="umbracoConfigurationStatus" value="7.3.4" />

<add key="umbracoConfigurationStatus" value="" />