我希望我的 Silverlight cloudapp 使用托管在名为 Reportviewer.aspx 的 WebForm 中的 SSRS Reportviewer 控件,当从我的 SL C# 类调用 javascript OpenReportviewer 函数时,这在测试 Azure“127.0.0.1”环境中运行良好:
<script type="text/javascript" src="Silverlight.js"></script>
<script type="text/javascript">
function OpenReportViewer(ReportViewerURL, TabHeading, EstId, ShowExtraDetail, ReportTypeID, PreExpandSections) {
var form = document.createElement('form');
form.action = ReportViewerURL; //'http://endorphin.cloudapp.net/Reporting/ReportViewer.aspx';
form.method = "POST";
form.target = '_blank'; // this is important to open a new window
var tabHeading = document.createElement('input');
tabHeading.name = 'TabHeading';
tabHeading.value = TabHeading;
form.appendChild(tabHeading);
var estID = document.createElement('input');
estID.name = 'EstID';
estID.value = EstId;
form.appendChild(estID);
var showExtraDetail = document.createElement('input');
showExtraDetail.name = 'ShowExtraDetail';
showExtraDetail.value = ShowExtraDetail;
form.appendChild(showExtraDetail);
var reportTypeID = document.createElement('input');
reportTypeID.name = 'ReportTypeID';
reportTypeID.value = ReportTypeID;
form.appendChild(reportTypeID);
var preExpandSections = document.createElement('input');
preExpandSections.name = 'PreExpandSections';
preExpandSections.value = PreExpandSections;
form.appendChild(preExpandSections);
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
}
function onSilverlightError(sender, args) {...
但是,我现在已经部署到真正的 Azure,它说:“调用失败:OpenReportviewer”
上面的函数现在完全粘贴了。
调用代码是:
//**********************************************************************************
public void Invoke3(string tabHeading, int estID, int reportTypeID, bool showExtraDetail, bool preExpandSections)
{
if (true == HtmlPage.IsPopupWindowAllowed)
{
string strBaseWebAddress = App.Current.Host.Source.AbsoluteUri;
int PositionOfClientBin =
App.Current.Host.Source.AbsoluteUri.ToLower().IndexOf(@"/clientbin");
strBaseWebAddress = Strings.Left(strBaseWebAddress, PositionOfClientBin);
string ReportViewerURL = String.Format(@"{0}/Reporting/ReportViewer.aspx", strBaseWebAddress);
try
{
HtmlPage.Window.Invoke("OpenReportViewer", ReportViewerURL, tabHeading, estID.ToString(),
showExtraDetail.ToString(), reportTypeID.ToString(), preExpandSections.ToString());
}
catch (Exception ex)
{
My.ShowError("Failed to invoke Webform for Report Viewer.", ex);
}
}
else
{
MessageBox.Show("You must enable popups to view reports. Safari browser is not supported.",
"Error", MessageBoxButton.OK);
}
}