【发布时间】:2018-12-13 19:11:43
【问题描述】:
我正在尝试将 pranha cms (5.3.1) 与 MySql 一起使用。这是我在 Startup.cs 文件中使用的代码,但出现此错误:
InvalidOperationException:没有为“Piranha.IApi”类型注册服务。可能是什么问题?
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMvc(config =>
{
config.ModelBinderProviders.Insert(0, new Piranha.Manager.Binders.AbstractModelBinderProvider());
});
services.AddPiranhaApplication();
services.AddPiranhaFileStorage();
services.AddPiranhaImageSharp();
services.AddDbContext<Db>(options =>
options.UseMySql("server=localhost;port=3306;database=piranha-mysql;uid=root;password="));
services.AddPiranhaManager();
services.AddPiranhaMemCache();
return services.BuildServiceProvider();
}
【问题讨论】: