在本地但在服务器上完美运行:无法加载资源:500(内部服务器错误)
Works perfect locally but on server: Failed to load resource: 500 (Internal Server Error)
我有一个 MVC5 Web 应用程序,我已经工作了一段时间。当我在本地工作时,它工作得很好。但是当我将它发布到我们公司的服务器时,在我打印收据的部分中我有 "Failed to load resource" 错误。正如我所说,当我在本地工作时它工作得很好。我正在使用 devexpress xtrareport .print() 方法打印收据。以下是我使用的一些代码:
POST 方法,这是我收到错误的视图:
function result() {
$(document).ready(function () {
value = document.getElementById('tutar').value;
var value3 = document.getElementById('bankalar').value;
var value2 = parseFloat(value);
try {
value1 = document.getElementById('1001').innerHTML;
} catch {
value1 = "Girilmedi";
}
if (document.getElementById("musteriAdi0").value == "") {
alert("Müşteri Adı Girilmeden İşlem Yapılamaz");
for (var u = p; u < i; u++) {
try {
var element = document.getElementById(u);
var row = element.parentNode.parentNode;
row.parentNode.removeChild(row);
} catch {
}
}
window.location.href = '@Url.Action("HizliAlimSatim", "Kuyumcu")';
}
else {
ekle();
var m = JSON.stringify({
'model': things, 'toplam': value2, 'personel': value1, 'KrediKarti': value3
});
things = [];
$(function () {
$.ajax({
type: "POST",
url: "/Kuyumcu/HizliAlimSatim",
contentType: "application/json; charset=utf-8",
dataType: "Json",
data: m,
success: function (data) {
if (data.includes("/Kuyumcu/Document") == false) {
g = g - i;
} else {
alert("İşlem Başarılı!");
//window.open(data, '_blank');
document.getElementById('tutar').value = 0;
toplam = 0;
degistir();
for (var u = p; u < i; u++) {
try {
var element = document.getElementById(u);
var row = element.parentNode.parentNode;
row.parentNode.removeChild(row);
} catch {
}
}
p = i;
window.location.reload(true);
}
}
});
});
}
});
}
这是我调用打印方法的控制器:
Fis report = new Fis();
report.Parameters["FisNo"].Value = id;
report.Parameters["Musteri"].Value = model[0].MusteriAdSoyad;
report.Parameters["Islemci"].Value = personel;
report.CreateDocument(false);
//report.ShowPreview();
report.PrintingSystem.ShowMarginsWarning = false;
report.Print();
return Json(Url.Action("Document", "Kuyumcu");
我已经尝试解决这个问题 2 天了,我认为这是一个服务器端问题,但无论我如何更改它都没有用。
控制器中的 XtraReport.Print 方法在服务器端被调用 - 这就是当您 运行 在 localhost 上的应用程序时它起作用的原因。当您将其部署到生产服务器时,Print 方法将在服务器机器上执行 - 而不是客户端机器。
假设您使用 DocumentViewer to display a report on your web page, use the viewer's client-side API (see the Print method) to print a report. For instance, refer to the sample code snippet from the How to display print dialog after the WebDocumentViewer is loaded on the web page 线程。
如果要打印报表而不显示它,请使用 following example 中显示的方法。
我有一个 MVC5 Web 应用程序,我已经工作了一段时间。当我在本地工作时,它工作得很好。但是当我将它发布到我们公司的服务器时,在我打印收据的部分中我有 "Failed to load resource" 错误。正如我所说,当我在本地工作时它工作得很好。我正在使用 devexpress xtrareport .print() 方法打印收据。以下是我使用的一些代码:
POST 方法,这是我收到错误的视图:
function result() {
$(document).ready(function () {
value = document.getElementById('tutar').value;
var value3 = document.getElementById('bankalar').value;
var value2 = parseFloat(value);
try {
value1 = document.getElementById('1001').innerHTML;
} catch {
value1 = "Girilmedi";
}
if (document.getElementById("musteriAdi0").value == "") {
alert("Müşteri Adı Girilmeden İşlem Yapılamaz");
for (var u = p; u < i; u++) {
try {
var element = document.getElementById(u);
var row = element.parentNode.parentNode;
row.parentNode.removeChild(row);
} catch {
}
}
window.location.href = '@Url.Action("HizliAlimSatim", "Kuyumcu")';
}
else {
ekle();
var m = JSON.stringify({
'model': things, 'toplam': value2, 'personel': value1, 'KrediKarti': value3
});
things = [];
$(function () {
$.ajax({
type: "POST",
url: "/Kuyumcu/HizliAlimSatim",
contentType: "application/json; charset=utf-8",
dataType: "Json",
data: m,
success: function (data) {
if (data.includes("/Kuyumcu/Document") == false) {
g = g - i;
} else {
alert("İşlem Başarılı!");
//window.open(data, '_blank');
document.getElementById('tutar').value = 0;
toplam = 0;
degistir();
for (var u = p; u < i; u++) {
try {
var element = document.getElementById(u);
var row = element.parentNode.parentNode;
row.parentNode.removeChild(row);
} catch {
}
}
p = i;
window.location.reload(true);
}
}
});
});
}
});
}
这是我调用打印方法的控制器:
Fis report = new Fis();
report.Parameters["FisNo"].Value = id;
report.Parameters["Musteri"].Value = model[0].MusteriAdSoyad;
report.Parameters["Islemci"].Value = personel;
report.CreateDocument(false);
//report.ShowPreview();
report.PrintingSystem.ShowMarginsWarning = false;
report.Print();
return Json(Url.Action("Document", "Kuyumcu");
我已经尝试解决这个问题 2 天了,我认为这是一个服务器端问题,但无论我如何更改它都没有用。
控制器中的 XtraReport.Print 方法在服务器端被调用 - 这就是当您 运行 在 localhost 上的应用程序时它起作用的原因。当您将其部署到生产服务器时,Print 方法将在服务器机器上执行 - 而不是客户端机器。
假设您使用 DocumentViewer to display a report on your web page, use the viewer's client-side API (see the Print method) to print a report. For instance, refer to the sample code snippet from the How to display print dialog after the WebDocumentViewer is loaded on the web page 线程。
如果要打印报表而不显示它,请使用 following example 中显示的方法。