在initilize DocumentStore期间,ASP.NET Core WebApi RavenDB错误

时间:2017-06-21 14:11:49

标签: c# asp.net asp.net-core ravendb

我有一个带RavenDB的WebApi ASP.NET Core(.NET Framework)项目 版本:

  • RavendDB v3.5.3
  • ASP.NET Core v1.1
  • .NET Framework v4.6.2
  • RavenDB.Client v3.5.3

我的代码:

启动课程

* { margin: 0; padding: 0 }
body { background: #ccc }
.slider {
    width: 640px;
    position: relative;
    padding-top: 320px;
    margin: 20px auto;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.75);
}
.slider > img {
    position: absolute;
    left: 0; top: 0;
    transition: all 0.5s;
    display: block
}
.slider input[name='slide_switch'] {
    display: none;
}
.slider label.next, .slider label.previous {
    position: absolute;
    left: 0; top: 0;
    display: block;
    font-size:3em;
    opacity: 0.6;
    cursor: pointer;
    color: white;
}
.slider label.next { left: 560px; line-height: 320px }
.slider label.previous { left: 50px; line-height: 320px; transform: rotateY(180deg) }
.slider label.thumbnail {
    margin: 18px 0 0 18px;
    border: 3px solid #999;
    float: left;
    cursor: pointer;
    transition: all 0.5s;
    opacity: 0.6;
}
.slider label.thumbnail:hover { opacity: 0.8 }
.slider label.thumbnail img {
    display: block;
}
.slider input[name='slide_switch']:checked + label.thumbnail {
    border-color: #666;
    opacity: 1;
}
.slider input[name='slide_switch'] ~ label.next,
.slider input[name='slide_switch'] ~ label.previous
{
    z-index: -1
}
.slider input[name='slide_switch']:checked ~ label.next,
.slider input[name='slide_switch']:checked ~ label.previous {
    z-index: 1
}
.slider input[name='slide_switch'] ~ img {
    opacity: 0;
    transform: scale(1.1);
}
.slider input[name='slide_switch']:checked + label.thumbnail + img {
    opacity: 1;
    transform: scale(1);
}

DocumentStoreHolder

 public void ConfigureServices(IServiceCollection services)
    {
        // Add framework services.
        services.AddMvc();
        DocumentStoreHolder.DatabaseName = "database";
        DocumentStoreHolder.Url = "http://localhost:8080/";
        services.AddSingleton(DocumentStoreHolder.Store);
        services.AddScoped<ISearchRepository, SearchRepository>();
    }

存储库

 public class DocumentStoreHolder
    {
        private static readonly Lazy<IDocumentStore> store = new Lazy<IDocumentStore>(CreateStore);
        public static string Url { get; set; }
        public static string DatabaseName { get; set; }

        public static IDocumentStore Store
        {
            get { return store.Value; }
        }

        private static IDocumentStore CreateStore()
        {
            var store = new DocumentStore
            {
                Url = Url,
                DefaultDatabase = DatabaseName
            }.Initialize();

            return store;
        }
    }

在DocumentStoreHolder类中初始化DocumentStore期间,我收到错误:

  

System.IO.FileNotFoundException:'无法加载文件或程序集   'NLog'或其依赖项之一。系统找不到该文件   指定。“

安装NLog v4.4.11后我收到错误:

  

Raven.Abstractions.Connection.ErrorResponseException:'复制   捆绑包未在名为“

”的数据库中激活

在另一个应用程序(Console App .NET Framework)中,相同的代码工作正常。

你能帮我吗?

1 个答案:

答案 0 :(得分:1)

这些是内部处理的异常,对系统没有影响。 只需在VS中点击F5然后让它运行。