这几天从JAVA转到ASP.NET C#
第一次做就出现问题了,如下:
在本机运行没任何问题 上传服务器就说Invalid temp directory in chart handler configuration [c:\TempImageFiles\] ,然后我第一次按照网上大神说的山区WEB.CONFIG里面DIR=xxx部分结果没用,但是很多网友说是有用的弄的我很郁闷,第二次就按另外个办法 在SOLUTION里面建立个FOLDER命名为TempImages,即:<asp:Chart ID="Chart1" runat="server" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" BackSecondaryColor="Red"
BorderlineColor="Red">
WEB.CONFIG 里面改为:<add key="ChartImageHandler" value="storage=file;timeout=20;Url=~/TempImages/;"/>
</appSettings>
然后就出现了
The temp directory in chart handler configuration is not accessible [C:\Inetpub\wwwroot\DKDWebsite\TempImages\].
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: The temp directory in chart handler configuration is not accessible [C:\Inetpub\wwwroot\DKDWebsite\TempImages\].
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[UnauthorizedAccessException: The temp directory in chart handler configuration is not accessible [C:\Inetpub\wwwroot\DKDWebsite\TempImages\].] System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings.Inspect() +765630 System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings.ParseParams(String parameters) +437 System.Web.UI.DataVisualization.Charting.ChartHttpHandler.InitializeParameters() +122 System.Web.UI.DataVisualization.Charting.ChartHttpHandler.get_Settings() +29 System.Web.UI.DataVisualization.Charting.ChartHttpHandler.InitializeControllerFile() +32 System.Web.UI.DataVisualization.Charting.ChartHttpHandler.EnsureInitialized(Boolean hardCheck) +368 System.Web.UI.DataVisualization.Charting.Chart.GetImageStorageMode() +24 System.Web.UI.DataVisualization.Charting.Chart.get_CurrentImageLocation() +40 System.Web.UI.DataVisualization.Charting.Chart.Render(HtmlTextWriter writer) +306 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Control.Render(HtmlTextWriter writer) +10 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +173 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Control.Render(HtmlTextWriter writer) +10 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Page.Render(HtmlTextWriter writer) +29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060 |
权限问题呗,异常很明显啊
System.UnauthorizedAccessException: The temp directory in chart handler configuration is not accessible
ASP.NET is not authorized to access the requested resource.
你这个操作,对web 应用程序来说,权限太高了,操作系统不让。
改下权限。
非常感谢,刚从学校出来 这方面我需要学习