开发者

Azure - permissions running ReportViewer

I'm successfully running a console app on a web role which runs at the correct time, and will send a test email successfully:

net start "task scheduler"
net user scheduler SecretP@ssw0rd /add
net localgroup Administrators scheduler /add
schtasks /create /SC WEEKLY /D THU /ST 17:30 /TN WariCheckNewFeed /TR %~dp0ConsoleAppToCallWebPage.exe /F /RU scheduler /RP SecretP@ssw0rd

Problem: when it gets to:

ReportParameter startAndEndDateStringParam = new ReportParameter("StartAndEndDateString", startAndEndDateString);

            LocalReport reportSummaryPDF = new LocalReport();
            reportSummaryPDF.ReportPath = "MerchantCampaignSummary.rdlc";

            reportSummaryPDF.SetParameters(new ReportParameter[] { campaignName, merchantNameParam, totalRedeemed, startAndEndDateStringParam });
            reportSummaryPDF.DataSources.Clear();
            reportSummaryPDF.DataSources.Add(datasource1);
            reportSummaryPDF.DataSources.Add(datasource2);

I get:

Application: ConsoleAppToCallWebPage.exe
                    Framework Version: v4.0.30319
                    Description: The process was terminated due to an unh开发者_如何转开发andled exception.
                    Exception Info: Microsoft.Reporting.WinForms.LocalProcessingException
                    Stack:
                       at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
                       at Microsoft.Reporting.WinForms.LocalReport.SetParameters(System.Collections.Generic.IEnumerable`1<Microsoft.Reporting.WinForms.ReportParameter>)
                       at ConsoleAppToCallWebPage.Program.SendMerchantSummaryAndBreakdownReports(System.String, System.Guid, System.Guid)
                       at ConsoleAppToCallWebPage.Program.Main(System.String[])

Azure - permissions running ReportViewer

DLLS are Version 10 of ReportViewer from my Win7 64 bit machine.

If I RDP onto the Azure web instance, I can successfully run the console app from e:\approot\startuptasks\consoleapptocallwebpage.exe

Feels like permissions!

<WebRole name="Web" vmsize="Small" enableNativeCodeExecution="true">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="HttpIn" endpointName="HttpIn" />
        </Bindings>
      </Site>
      <Site name="WebMVCAdmin" physicalDirectory="c:\publishWebMVCAdmin">
        <Bindings>
          <Binding name="HttpIn" endpointName="HttpIn" hostHeader="pvadmin8.mateerit.co.nz" />
        </Bindings>
      </Site>
    </Sites>
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" />
      <Setting name="DataConnectionString" />
      <Setting name="SQLAzureRetryCountMaximum" />
      <Setting name="SQLAzureRetryDelaymSec" />
    </ConfigurationSettings>
    <Endpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
    </Imports>
    <Startup>
      <Task commandLine="StartupTasks\addScheduledTaskRunner.cmd" executionContext="elevated" taskType="simple" />
      <Task commandLine="StartupTasks\disableTimeout.cmd" executionContext="elevated" />
    </Startup>
  </WebRole>


The answer was that running as a scheduled task the reportviewer was looking in the wrong directory for the rdlc file!

reportSummaryPDF.ReportPath = @"e:\approot\bin\StartupTasks\myreport.rdlc";

http://blog.smarx.com/posts/windows-azure-startup-tasks-tips-tricks-and-gotchas
http://www.voiceoftech.com/swhitley/index.php/2011/07/windows-azure-task-scheduler/

Running locally on Win7 scheduled tasks helped to debug.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜