【问题标题】:connecting to Azure database连接到 Azure 数据库
【发布时间】:2016-01-12 11:10:23
【问题描述】:

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

当我尝试从我的应用程序连接到 Azure db 时出现问题,我已经使用 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

有什么想法吗?

【问题讨论】:

    标签: azure umbraco azure-sql-database


    【解决方案1】:

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

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

    仔细检查 umbracoDbDSN 连接字符串和提供者名称。您可以尝试通过清空 web.config 中 umbracoConfigurationStatus 的值,在 SQL Azure 数据库中重新安装 Umbraco。

    替换

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

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

    【讨论】:

      【解决方案2】:

      我不熟悉 Umbraco,但您是否关注了他们网站上的 migration guide to Azure SQL

      MSDN 上的This post 也引用了 Azure Umbraco Acceletator

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

      【讨论】:

        猜你喜欢
        • 2018-05-04
        • 1970-01-01
        • 1970-01-01
        • 2019-11-13
        • 2021-09-03
        • 2016-02-03
        • 2022-01-26
        • 1970-01-01
        相关资源
        最近更新 更多