Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# UnauthorizedAccessException-映像位置不在指定目录下_C#_Asp.net_Iis 8.5 - Fatal编程技术网

C# UnauthorizedAccessException-映像位置不在指定目录下

C# UnauthorizedAccessException-映像位置不在指定目录下,c#,asp.net,iis-8.5,C#,Asp.net,Iis 8.5,我正在将一个用asp.NET编写的网站从windows server 2003计算机复制到使用IIS 8.5的windows server 2012 该网站在旧机器上运行良好,但在新机器上我的任何网页中都没有显示图表 我得到一个奇怪的错误: General Information -------------------------------- MachineName: AYEVENS12MAVTST TimeStamp: 10/08/2014 11:38:18 WindowsIdent

我正在将一个用asp.NET编写的网站从windows server 2003计算机复制到使用IIS 8.5的windows server 2012

该网站在旧机器上运行良好,但在新机器上我的任何网页中都没有显示图表

我得到一个奇怪的错误:

    General Information
--------------------------------
MachineName: AYEVENS12MAVTST
TimeStamp: 10/08/2014 11:38:18
WindowsIdentity: NT AUTHORITY\SYSTEM

Exception Information
---------------------------------------
Exception Type: System.UnauthorizedAccessException
Message: The image location is not under specified directory.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ValidateUri(System.String)
HelpLink: NULL
Source: System.Web.DataVisualization
HResult: -2147024891

StackTrace Information
---------------------------------------
   at System.Web.UI.DataVisualization.Charting.ChartHttpHandlerSettings.ValidateUri(String key)
   at System.Web.UI.DataVisualization.Charting.DefaultImageHandler.System.Web.UI.DataVisualization.Charting.IChartStorageHandler.Load(String key)
   at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.ProcessSavedChartImage(HttpContext context)
   at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
这很奇怪,因为我看到图片的路径是正确的,我可以毫无问题地打开图片。 我认为这是权限问题,但我将包含文件夹的完全控制权交给了IIS_USRS和WindowsIdentity:NT AUTHORITY\SYSTEM,同样的错误不断出现。 让我烦恼的是,有一条消息说映像位置不在指定目录下。因为图像就是它应该在的地方


非常感谢您的帮助。

您是否尝试使用web.config文件模拟特定的授权windows帐户

    <configuration>
      <system.web>
        <identity impersonate="true" userName="user name" password=" user password" />
      </system.web>
    </configuration>

好吧,我不小心拆下了线路,解决了这个问题

<add key="ChartImageHandler" value="storage=file;privateImages=false;timeout=600;dir=c://TempImageFiles;deleteAfterServicing=false;" />

从网络配置中,我不知道为什么会这样。

您真的确定它在本地主机上运行良好吗?如果是,则应检查Windows Server 2012中的IIS 8.5设置。