小编Ble*_*ill的帖子

System.InvalidOperationException:无法解析类型的服务

我正在使用ASP.NET Core开发Web API.当我使用post请求执行我的API时,在UnitController的Post方法中的断点之前抛出异常.

例外

请求启动HTTP/1.1 POST http:// localhost:5000/api/unit application/json 31 failed:Microsoft.AspNetCore.Server.Kestrel [13]连接ID"0HKVTL9A1LTD4":应用程序抛出了未处理的异常.System.InvalidOperationException:尝试激活"Project.Service.UnitService"时无法解析类型"Project.DataAccess.Repository.UnitRepository"的服务.

上下文

namespace Project.DataAccess.Library.Interface {
public interface IBaseRepository<M> where M : class, IEntity
{
    IEnumerable<M> SelectAll();

    M SelectByID(int id);

    void Insert(M obj);

    void Update(M obj);

    void Delete(int id);

    void Save();
}
}

namespace Project.DataAccess.Library {
public abstract class BaseRepository<M> : IBaseRepository<M> where M : class, IEntity
{
    protected ProjectContext Db { get; }
    private DbSet<M> table = null;

    protected DbSet<M> Table
    {
        get
        {
            return …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection .net-core asp.net-core asp.net-core-webapi

7
推荐指数
1
解决办法
6401
查看次数

Highcharts导出图表exportSettings与svg文件

我想用.Net Core项目在后面渲染地图文件

因此,目的是在Javascript中间件上执行Highmaps库,并将svg文件导出到"node-export-server".

我有一个API从客户端接收一些数据.我想用Highmap库生成SVG映射文件,然后发送到另一个API,它将包含一个中间件来执行PNG/JPG/...导出的节点模块.

将svg文件传递给"node-export-server"模块的方法是什么?我阅读了副文档,但我没有找到方法......(https://github.com/highcharts/node-export-server/blob/master/README.md)

我想通过此示例传递我的SVG文件.

//Include the exporter module
const exporter = require('highcharts-export-server');

//Export settings 
var exportSettings = {
    type: 'png',
    options: {
        title: {
            text: 'My Chart'
        },
        xAxis: {
            categories: ["Jan", "Feb", "Mar", "Apr", "Mar", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
        },
        series: [
            {
                type: 'line',
                data: [1, 3, 2, 4]
            },
            {
                type: 'line',
                data: [5, 3, 4, 2]
            }
        ]
    }
};

//Set up a pool of PhantomJS workers
exporter.initPool();

//Perform …
Run Code Online (Sandbox Code Playgroud)

highcharts node.js highmaps .net-core

7
推荐指数
1
解决办法
550
查看次数

Hangfire:缺少 UseSqlServerStorage 方法

我正在尝试为 ASP.NET 代码项目安装 HangFire。

当我按照官方文档(https://www.hangfire.io/blog/2016/07/16/hangfire-1.6.0.html)或其他链接资源(http://www.dotnetjalps.com/2017/ 04/aspnet-core-hangfire-integation.html),听起来很清楚。添加这个

services.AddHangfire(config=>config.UseSqlServerStorage(Configuration.GetConnectionString("MyConnectionString")));
Run Code Online (Sandbox Code Playgroud)

但它不起作用。此扩展方法不存在。我错过了什么吗?

sql-server hangfire asp.net-core

0
推荐指数
1
解决办法
2442
查看次数