2011-10-21 8 views
0

私はSystem.Web.DataVisualizationのチャートを使用しています。プロセスはSystem.Web.UI.DataVisualization.Chartingでファイルエラーにアクセスできません。

<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %> 
... 
<asp:Chart ImageType="Png" runat="server" ID="chartStatComp" Palette="BrightPastel" 
    ImageLocation="~/CRM/Reports/chartStatComp_#SEQ(100,10)" ImageStorageMode="UseImageLocation" 
    Width="620" Height="300"> 
    <ChartAreas> 
     <asp:ChartArea Name="MainChartArea"> 
     </asp:ChartArea> 
    </ChartAreas> 
    <Series> 
     <asp:Series ChartArea="MainChartArea" ChartType="Pie" XValueType="String" YValueType="Int32" 
      CustomProperties="DoughnutRadius=25, PieDrawingStyle=Concave, CollectedLabel=Other, MinimumRelativePieSize=20" 
      XValueMember="StateDescription" YValueMembers="CNT" Legend="Legend" IsVisibleInLegend="true" 
      IsValueShownAsLabel="true"> 
     </asp:Series> 
    </Series> 
    <Legends> 
     <asp:Legend LegendStyle="Table" Name="Legend" Alignment="Near" 
      TitleAlignment="Near"> 
      <CellColumns> 
       <asp:LegendCellColumn Text="Color" ColumnType="SeriesSymbol" /> 
       <asp:LegendCellColumn Text="#LEGENDTEXT" ColumnType="Text" Alignment="TopLeft" HeaderText="State" /> 
       <asp:LegendCellColumn Text="#VAL" ColumnType="Text" Name="Cnt" Alignment="TopLeft" 
        HeaderText="Count" /> 
       <asp:LegendCellColumn Text="#PERCENT" ColumnType="Text" Name="Percentage" Alignment="TopLeft" 
        HeaderText="%" /> 
      </CellColumns> 
     </asp:Legend> 
    </Legends> 
</asp:Chart> 

これはほとんどの場合よく機能します。しかし時々ユーザーは例外を得ます:

System.IO.IOException: The process cannot access the file '~\Reports\chartStatComp_000001.png' because it is being used by another process. 

それは非常にまれですが起こります。 誰も同じような問題に直面していますか?

+0

私はちょうどコード魔法使いがファイルに独特な名前を与え、古いものをきれいにすることを加えました。新しいファイルは新しいロックされています。 –

答えて

0

詳細な解析コードを入力してください。

しかし、この時点では、書き込み/読み取りを試みるときにファイルがオープン状態である必要があります。ファイルが処理中で、処理が完了していない可能性があるため、まれに起こっている必要があります。あなたのコードの実行は、このような偶然のタイプに入るのに十分速かった。

+0

私はコードを提供しました。はい、処理中のファイルであれば、どうすれば確認できますか? –

関連する問題