错误:无法启动节点进程

时间:2017-09-06 13:46:22

标签: asp.net-core

如何生成pdf?我正在尝试节点服务,但它无法正常工作。我有visual studio 2015 Microsoft.NETCore.App:1.0.1

        [HttpGet]
        public async Task<IActionResult> Index([FromServices] INodeServices nodeServices)
        {
            HttpClient hc = new HttpClient();
            var htmlContent = await hc.GetStringAsync($"http://{Request.Host}/report.html");
            var result = await nodeServices.InvokeAsync<byte[]>("./pdf", htmlContent);

            HttpContext.Response.ContentType = "application/pdf";

            HttpContext.Response.Headers.Add("x-filename", "report.pdf");
            HttpContext.Response.Headers.Add("Access-Control-Expose-Headers", "x-filename");
            HttpContext.Response.Body.Write(result, 0, result.Length);
            return new ContentResult();
        }

enter image description here

0 个答案:

没有答案
相关问题