【问题标题】:Keyword not supported: 'metadata'. in Hangfire不支持关键字:“元数据”。在杭火
【发布时间】:2018-08-31 13:14:10
【问题描述】:

我正在使用 asp.net mvc 应用程序,我想设置用户请求的提醒, 在startup.cs 类中我配置了hangfire。但它给出了异常,不支持关键字:'元数据'。当阅读这行代码 GlobalConfiguration.Configuration .UseSqlServerStorage("DbEntities");

using Hangfire;
using Hangfire.SqlServer;
using Microsoft.Owin;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UKC.Data.Infrastructure;
using UKC.UI.Helper;

[assembly: OwinStartup(typeof(UKC.UI.App_Start.Startup))]
namespace UKC.UI.App_Start
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
            GlobalConfiguration.Configuration
               .UseSqlServerStorage("DbEntities");

        }
    }
}

【问题讨论】:

    标签: c# asp.net-mvc hangfire


    【解决方案1】:

    在我的情况下,这是因为配置文件中的连接字符串不正确。

            <add name="HangfireEntities" connectionString="metadata=res://*/Model.DBModel.csdl|res://*/Model.DBModel.ssdl|res://*/Model.DBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=localhost;initial catalog=HangfireTest;persist security info=True;user id=sa;password=myStrongPassw0rd;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    

    应该是

    <add name="HangfireEntities" connectionString="Server=.\\localhost; Database=HangfireTest;user id=sa;password=myStrongPassw0rd" providerName="System.Data.EntityClient" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-14
      • 1970-01-01
      • 1970-01-01
      • 2010-11-27
      • 1970-01-01
      • 1970-01-01
      • 2016-04-10
      • 1970-01-01
      相关资源
      最近更新 更多