C# 在Live Server(Windows Server 2008 R2 enterprise)中,PDF不是使用wkhtmltopdf.exe生成的,而是在本地主机中工作的

C# 在Live Server(Windows Server 2008 R2 enterprise)中,PDF不是使用wkhtmltopdf.exe生成的,而是在本地主机中工作的,c#,asp.net,.net,wkhtmltopdf,html-to-pdf,C#,Asp.net,.net,Wkhtmltopdf,Html To Pdf,我们使用wkhtmltopdf.exe的时间长达10个月,它一直没有问题,但从几天开始,我们就面临wkhtmltopdf.exe的问题。现在我们从wkhtmltopdf.exe中得到错误,并且PDF不是为我们生成的,我们使用Java脚本。当我点击页面时,会转到我们的“书写错误”页面。我们在PDF中遇到的问题是wkhtmltopdf.exe中没有任何版本。我们的代码和应用程序非常清楚。wkhtmltopdf.exe在本地工作,为什么不在live Server Windows 2008 R2 ent

我们使用wkhtmltopdf.exe的时间长达10个月,它一直没有问题,但从几天开始,我们就面临wkhtmltopdf.exe的问题。现在我们从wkhtmltopdf.exe中得到错误,并且PDF不是为我们生成的,我们使用Java脚本。当我点击页面时,会转到我们的“书写错误”页面。我们在PDF中遇到的问题是wkhtmltopdf.exe中没有任何版本。我们的代码和应用程序非常清楚。wkhtmltopdf.exe在本地工作,为什么不在live Server Windows 2008 R2 enterprise中工作?我们已经尝试了wkhtmltopdf站点的所有版本[所有这些都在localhost中工作,但未在live server中工作。我们的本地服务器iis版本为7.5,与live server中的相同,关于iis版本7.5,下一步要做什么??在localhost中,正在生成pdf,iis版本为7.5,在Windows server 2008 R2 enterprise中具有相同的版本,但未生成pdf

   protected void Export(object sender, EventArgs e)
    {          
        String GlobalDomainName = System.Configuration.ConfigurationManager.AppSettings["live_domainName"];

        string url = "PropertyEWC.aspx?id=" + PropertyId + "&bid=" + UserData.BranchId + "&aid=" + UserData.CompanyId;


        string args = string.Format("\"{0}\" - ", GlobalDomainName + url);
        var startInfo = new ProcessStartInfo("C:\\Program Files\\wkhtmltopdf1\\bin\\wkhtmltopdf.exe", args)
        {

            UseShellExecute = false,
            CreateNoWindow = true,
            RedirectStandardOutput = true

        };
        var proc = new Process { StartInfo = startInfo };
        proc.Start();
        string output = proc.StandardOutput.ReadToEnd();
        byte[] buffer = proc.StandardOutput.CurrentEncoding.GetBytes(output);
        proc.WaitForExit();
        proc.Close();
        Response.ContentType = "application/pdf";
        Response.AddHeader("Content-Disposition", "attachment;filename=ElectronicWindow.pdf");
        Response.BinaryWrite(buffer);
        Response.End();
    }

在上面的代码中,我们在proc.start中遇到了错误。解决此错误的方法是使用proc.start的任何替代方法。

它通过更改wkhtmltopf.exe属性对我有效。 右键单击wkhtmltopdf.exe上的鼠标,选择属性 在属性中选择安全选项。
在这种情况下,您可以更改访问选项。

调用Start时会出现什么错误?页面将出现运行时错误@mikez@mikez页面将要运行时错误我在服务器中遇到类似的Word问题。如果有人登录此服务器,它会工作吗?