ユーザーが独自の PDF レポートを作成できる従来の ASP アプリケーションを開発しました。http://neeviapdf.com/PDFmerge/のソフトウェアを使用して、pdf をマージしました。アプリケーションは、私の VS2012 でローカルに実行するとうまく機能します。しかし、Web サイトのコンテンツをリモートの Windows 2008 サーバーに公開すると、レポートを作成しようとすると内部サーバー エラーが発生します。私は道に迷っており、何が問題なのかわかりません。私はほぼすべてを試しましたが、アイデアがありません。サーバーは適切に構成されており、サーバーにmergepdfソフトウェアをインストールし、アプリケーションを使用するユーザーに権限を与えました. そして、何も機能していません。
これが私の html マークアップです。ほとんどの html コードを取り除き、重要なものだけを残しました。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Build Your Own Report</title>
<link href="css/mainel.css" rel="stylesheet" />
<link href="css/main.css" rel="stylesheet" />
<link href='http://fonts.googleapis.com/css?family=Cinzel' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,500,700' rel='stylesheet' type='text/css' />
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
<script type="text/javascript">
if (navigator.userAgent.match(/iPad/i)) {
var viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0';
jQuery(document).ready(function() {
document.body.addEventListener('gesturestart', function () {
viewportmeta.content = 'width=device-width, minimum-scale=0.20, maximum-scale=1.0';
}, false);
});
}
}
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/jquery.form.js"></script>
<script src="js/jquery.url.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var page = $('.report-tree .checkbox');
var mainPage = $('.section-node .section-name');
var allLink = $('.check-all');
var pageNum;
var Select_Section = $('.select-sec');
var Clear_Section = $('.clear-sec');
page.click(function () {
pageNum = $(this).val();
if ($(this).is(':checked')) {
//console.log(pageNum);
}
});
mainPage.click(function () {
if ($(this).parent('div').parent('li').hasClass('expanded')) {
$(this).parent().parent('li').removeClass('expanded');
$(this).parent().parent('li').children('.inner-pages').slideUp(400);
} else {
$(this).parent().parent('li').addClass('expanded');
$(this).parent().parent('li').children('.inner-pages').slideDown(400);
}
});
allLink.click(function () {
if (($(this).attr('id')) == 'select-all') {
page.attr('checked', 'checked');
$('input#report-submit.button').attr('src', 'img/build-my-report.jpg')
$('.section-node').parent('li').addClass('expanded');
$('.inner-pages').slideDown(400);
} else {
page.attr('checked', '');
$('input#report-submit.button').attr('src', 'img/builder-btn.png')
$('.section-node').parent('li').removeClass('expanded');
$('.inner-pages').slideUp(400);
}
return false;
});
Select_Section.click(function () {
$(this).parent('.select-links').parent('div').parent('li').children('.inner-pages').children('.report-subpages').children('li').children('.subpage-node').children('.checkbox').attr('checked', 'checked');
$(this).parent('.select-links').parent('div').parent('li').children('.inner-pages').children('.report-subpages').children('li').children('.report-subpages').children('li').children('.subpage-node').children('.checkbox').attr('checked', 'checked');
if ($(this).parent('.select-links').parent('div').parent('li').children('.inner-pages').children('.report-subpages').children('li').children('.subpage-node').children('.checkbox').attr('checked', 'checked')) {
$('input#report-submit.button').attr('src', 'img/build-my-report.jpg')
}
$(this).parent('.select-links').parent().parent('li').children('.inner-pages').slideDown(400);
$(this).parent('.select-links').parent('div').parent('li').addClass('expanded');
return false;
});
Clear_Section.click(function () {
$(this).parent('.select-links').parent('div').parent('li').children('.inner-pages').children('.report-subpages').children('li').children('.subpage-node').children('.checkbox').attr('checked', '');
$(this).parent('.select-links').parent('div').parent('li').children('.inner-pages').children('.report-subpages').children('li').children('.report-subpages').children('li').children('.subpage-node').children('.checkbox').attr('checked', '');
if ($(this).parent('.select-links').parent('div').parent('li').children('.inner-pages').children('.report-subpages').children('li').children('.report-subpages').children('li').children('.subpage-node').children('.checkbox').attr('checked', '')) {
$('input#report-submit.button').attr('src', 'img/builder-btn.png')
}
$(this).parent('.select-links').parent().parent('li').children('.inner-pages').slideUp(400);
$(this).parent('.select-links').parent('div').parent('li').removeClass('expanded');
return false;
});
/*$('.checkbox').click(function () {
if ($(this).is(':checked'))
alert('checked');
else
alert('unchecked');
});*/
function setupProcessing(formData, jqForm, options) {
var val = $('#report-builder').valid();
if (val) {
$('#download-restart').hide();
$('#ajax-loader').show();
$('input#report-submit.button').attr('src', 'img/build-my-report.jpg').css({ 'opacity': '0.2', ' filter': 'alpha(opacity = 50)' });
} else {
$('#make-a-selection').show();
}
return val;
}
function showResponse(responseText, statusText, xhr, $form) {
$('#ajax-loader').hide();
$('#download-report-link').attr('href', responseText);
$('#download-restart').show();
$('#report-submit').hide();
$('#download-report-link').click(function () {
setTimeout("window.location = window.location", 100);
});
}
var options = {
//target: '#output1', // target element(s) to be updated with server response
beforeSubmit: setupProcessing, // pre-submit callback
success: showResponse, // post-submit callback
timeout: 30000,
// other available options:
//url: url // override for form's 'action' attribute
//type: "post", // 'get' or 'post', override for form's 'method' attribute
//dataType: null // 'xml', 'script', or 'json' (expected server response type)
//clearForm: true, // clear all form fields after successful submit
//resetForm: true, // reset the form after successful submit
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("An error has occurred while generating your report, please try again later.\nThe error was: " + errorThrown);
$('#ajax-loader').hide();
$('#report-submit').show();
}
};
// bind form using 'ajaxForm'
$('#report-builder').ajaxForm(options);
$("#report-builder").validate({
errorLabelContainer: "#make-a-selection",
rules: {
"Page[]": "required"
},
messages: {
"Page[]": "Please choose at least one report to include."
}
});
$('li.report-node-1 > div > input[type=checkbox]').click(function () {
if (!$(this).is(':checked')) {
$('input[type=checkbox][name=Page\[\]]', $(this).parents('.report-node-1')).attr('checked', false);
}
});
});
</script>
</head>
<body>
<div class="page-content">
<div id="report-bulder">
<div id="make-a-selection" style="display:none;">
</div>
<form name="Report_Builder" action="stjreport/mergepdf_a.asp" method="post" id="report-builder">
<input type="hidden" name="dowhat" value="merge" />
<ul class="report-tree">
<li class="report-node-1">
<div class="section-node">
<span class="section-name dark-green">
<input type="hidden" class="hidden" name="PageSec[]" value="1" id="page-1" />
Letter from Daniel J. Starks
<span class="arrow-1"></span>
</span>
<span class="select-links">
<a href="#select-section" class="select-sec">Select Section</a> | <a href="#clear-section" class="clear-sec" >Clear Section</a>
</span>
</div>
<div class="inner-pages">
<ul class="report-subpages">
<li><div class="subpage-node">
<input type="checkbox" class="checkbox" name="Page[]" value="letter-to-our-shareholder.pdf" id="letter-1" />
<label for="letter-1" class="label-1">Letter from Daniel J. Starks</label>
</div>
</li>
</ul>
</div>
</li>
<li class="report-node-1">
<div class="section-node">
<span class="section-name light-green">
<input type="hidden" class="hidden" name="PageSec[]" value="1" id="Hidden1" />Embrace the Future<span class="arrow-2"></span></span>
<span class="select-links"><a href="#select-section" class="select-sec">Select Section</a> | <a class="clear-sec" href="#clear-section">Clear Section</a>
</span>
</div>
<div class="inner-pages">
<ul class="report-subpages">
<li>
<div class="subpage-node"><input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-2.pdf" id="embrace-1" />
<label for="embrace-1" class="label-2">Products</label>
</div>
</li>
<li>
<div class="subpage-node"><input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-3.pdf" id="embrace-2" />
<label for="embrace-2" class="label-2">Service</label>
</div>
</li>
<li>
<div class="subpage-node">
<input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-4.pdf" id="embrace-3" />
<label for="embrace-3" class="label-2">Technology</label>
</div>
</li>
<li>
<div class="subpage-node">
<input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-5.pdf" id="embracee-4" />
<label for="embrace-4" class="label-2">Marketing</label>
</div>
</li>
</ul>
</div>
</li>
<li class="report-node-1"><div class="section-node"><span class="section-name purple">
<input type="hidden" class="hidden" name="PageSec[]" value="10" id="page-10" />Case Study<span class="arrow-3"></span></span>
<span class="select-links"><a href="#select-section" class="select-sec">Select Section</a> | <a class="clear-sec" href="#clear-section">Clear Section</a></span></div>
<div class="inner-pages">
<ul class="report-subpages">
<li>
<div class="subpage-node"><input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-6.pdf" id="case-1" />
<label for="case-1" class="label-3">Florida Case Study</label></div>
</li>
<li>
<div class="subpage-node"><input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-7.pdf" id="case-2" />
<label for="case-2" class="label-3">California Case Study</label>
</div>
</li>
</ul>
</div>
</li>
<li class="report-node-1"><div class="section-node">
<span class="section-name red"><input type="hidden" class="hidden" name="PageSec[]" value="11" id="page-11" />Corporate Social Responsibility<span class="arrow-4"></span>
</span>
<span class="select-links"><a href="#select-section" class="select-sec">Select Section</a> | <a class="clear-sec" href="#clear-section">Clear Section</a></span></div>
<div class="inner-pages">
<ul class="report-subpages">
<li>
<div class="subpage-node"><input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-11.pdf" id="social-1" />
<label for="social-1" class="label-4">Corporate Social Responsibility</label>
</div>
</li>
</ul>
</div>
</li>
<li class="report-node-1">
<div class="section-node"><span class="section-name yellow"><input type="hidden" class="hidden" name="PageSec[]" value="12" id="page-12" />Corporate Information <span class="arrow-5"></span></span><span class="select-links"><a href="#select-section" class="select-sec">Select Section</a> | <a class="clear-sec" href="#clear-section">Clear Section</a></span></div>
<div class="inner-pages">
<ul class="report-subpages">
<li>
<div class="subpage-node"><input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-12.pdf" id="corporate-information-1" />
<label for="corporate-information-1" class="label-5">Corporate Information</label>
</div>
</li>
</ul>
</div>
</li>
<li class="report-node-1"><div class="section-node">
<span class="section-name purple"><input type="hidden" class="hidden" name="PageSec[]" value="13" id="page-13" />Financial Highlights<span class="arrow-3"></span></span><span class="select-links"><a href="#select-section" class="select-sec">Select Section</a> | <a class="clear-sec" href="#clear-section">Clear Section</a></span></div>
<div class="inner-pages">
<ul class="report-subpages">
<li>
<div class="subpage-node"><input type="checkbox" class="checkbox" name="Page[]" value="Infinity-Full-Annual-Report-13.pdf" id="financial-1" />
<label for="financial-1" class="label-3">Financial Highlights</label>
</div>
</li>
</ul>
</div>
</li>
</ul>
<div class="check-controls">
<div class="controls-holder">
<a href="#select-all" class="check-all" id="select-all">Select all</a> | <a href="#clear-all" class="check-all" id="clear-all">Clear all</a>
</div>
</div><!-- end .check-controls -->
<div class="builder-buttons">
<div>
<input type="image" name="Submit" class="button" id="report-submit" src="img/builder-btn.png" />
<div id="ajax-loader" style="display:none;margin-top:8px; text-align:right;"><img src="img/ajax-loader.gif" /></div>
<div id="download-restart" style="display:none;">
<div class="button-block">
<!--a id="download-report-link" target="_blank" href="#"><img src="../i/download_button.gif" alt="Download Report" width="120" height="24" border="0" /></a-->
<a id="download-report-link" target="_blank" href="#" style="font-weight: bold;font-size:14px;margin:15px 0 15px 0;"></a>
</div><!-- end .button-block-->
<div class="button-block">
<!--a id="restart-link" href=""><img src="../i/new_report_button.gif" alt="Start New Report" width="120" height="24" border="0" /></a-->
</div><!-- end .button-block-->
</div><!-- end #download-restart -->
</div>
</div><!-- end #bulder-builder -->
</form><!-- end #report-builder -->
</div><!-- end #report builder -->
</div><!-- end .page-content-->
</div><!-- end #contright -->
</div><!--end .wrapper .floatwrapper-->
</div><!--end .buildreportmain-->
**When the form is submitted I call the following server side scripts. This is the code the does all the back end processing in the order that they are called**
**mergepdf_a.pdf**
<!--#include file="_mergepdf.asp"-->/stjreport/temp/<%=fileName %>.pdf
**_mergepdf.asp**
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<!--#include file="includes/includes.inc"-->
<%
set fso = server.CreateObject("Scripting.FileSystemObject")
Set NVmerge = CreateObject("Neevia.PDFmerge")
action = LCase(trim(request("dowhat")))
cleanitup(300)
select case action
case "merge"
inPath = ""
' more efficient loop?
For Each item In Request.Form("Page[]")
if fso.fileExists(pdf_path &"/"& trim(item)) then inPath = inPath & pdf_path & "/" & trim(item) & "+"
Next
' for m=1 to 50
' for n=1 to 50
' if len(trim(request("chb_"&m&"_"&n))) > 0 then
' if fso.fileExists(pdf_path &"/"& trim(request("chb_"&m&"_"&n))) then inPath = inPath & pdf_path & "/" & trim(request("chb_"&m&"_"&n)) & "+"
' end if
' next
' next
if len(trim(inPath)) > 0 then
inPath = left(inPath,len(inPath)-1)
fileName = replace(replace(replace(now(),"/",""),":","")," ","")
fileName = fileName & makeRandomString(2)
outPath = tmp_Path & "/" & fileName & ".pdf"
success = NVMerge.MergePDF(inPath,outPath)
'response.write "inpath: " & inpath & "<br>"
'response.write "outpath: " & outpath & "<br>"
'response.write "s: " & success & "<br>"
'response.flush
end if
end select
%>
**includes.inc**
<%
thisPage = Request.ServerVariables("SCRIPT_NAME")
thisPage = Right(thisPageName,Len(thisPage) - InStrRev(thisPage,"/"))
session.timeout = 5
webDir = "/stjreport"
pdf_path = server.MapPath("/") & webDir & "/pdfs"
tmp_path = server.MapPath("/") & webDir & "/temp"
Function RoundUp(n)
roundUp = Int(n) - CBool(CDbl(n) <> CLng(n))
End Function
Sub cleanItUp(tt)
set incFS = server.createobject("scripting.FileSystemObject")
set incFO = incFS.GetFolder(tmp_path)
for each incF in incFO.files
'if instr(1,incF.name,".pdf",1) > 0 then
set tmpF = incFS.GetFile(incF)
if DateDiff("s",tmpF.DateCreated,now) > tt then incFS.deleteFile(tmpF)
'end if
next
set incFO = nothing
set incFS = nothing
End Sub
Function makeRandomString(incLength)
makeRandomString = ""
seedStr = "1,N,O,P,Q,3,W,X,Y,Z,$,4,0,A,B,C,D,E,F,8,G,H,I,J,5,6,7,9,K,L,M,R,2,S,U,V,T,"
rndAry = Split(seedStr,",")
rndName = ""
For inc = 1 to incLength
Randomize
iRandom = Int( UBound( rndAry ) * Rnd )
rndName = rndName & rndAry( iRandom )
next
makeRandomString = rndName
End Function
Sub displayMessage (incMsg,incReturnUrl)
if Len(incMsg) > 0 then
Response.write("<br /><br /><p style='text-align:center; font-family:arial; font_size:larger;'>" & incMsg & "</p>")
%>
<script language="javascript">
alert("<%=Replace(Replace(incMsg,"<br />","\n"),"<br>","\n")%>");
<%
if Len(incReturnUrl) > 0 then
%>
top.location.href = "<%=incReturnUrl%>";
<%
else
%>
top.history.go(-1);
<%
end if
%>
</script>
<%
Response.end()
end if
End Sub
Function isPermittedFile(incFileType,incFile)
incFile = replace(incFile, "\", "/")
if inStr(incFile,"/") > 0 then
incAry = split(incFile,"/")
incFile = incAry(uBound(incFile)-1)
end if
if inStr(incFile,".") = 0 then call (displayMessage("Image file: " & incFile & " sounds not to be a recognized image format",""))
incFileAry = split(incFile,".")
incExt = incFileAry(1)
Select Case LCase(incFileType)
Case "image"
incAllowedStr = ",gif,png,jpg,jpeg,bmp,tiff,"
Case "document"
'incAllowedStr = ",pdf,doc,docx,txt,rtf,doc,docx,xls,xlsx,"
incAllowedStr = ",pdf,"
End Select
isPermittedFile = False
if inStr(1,incAllowedStr,","& LCase(incExt) &",",1) > 0 then isPermittedFile = True
End Function
%>
Again it works locally but for some reason it breaks on the live server. Any help would be great.